← Back to team overview

curtin-dev team mailing list archive

[Merge] ~dbungert/curtin:no-attrs into curtin:master

 

Dan Bungert has proposed merging ~dbungert/curtin:no-attrs into curtin:master.

Commit message:
Remove usage of python3-attr

Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/436274
-- 
Your team curtin developers is requested to review the proposed merge of ~dbungert/curtin:no-attrs into curtin:master.
diff --git a/curtin/commands/apt_config.py b/curtin/commands/apt_config.py
index 0d559e2..f9cce34 100644
--- a/curtin/commands/apt_config.py
+++ b/curtin/commands/apt_config.py
@@ -404,7 +404,7 @@ def add_apt_key_raw(keyname, key, target=None):
         keyfile_ext = 'gpg'
         omode = 'wb'
 
-    keyfile = f'/etc/apt/trusted.gpg.d/{keyname}.{keyfile_ext}'
+    keyfile = '/etc/apt/trusted.gpg.d/{}.{}'.format(keyname, keyfile_ext)
     target_keyfile = paths.target_path(target, keyfile)
     util.write_file(target_keyfile, key, mode=0o644, omode=omode)
     LOG.debug("Adding key to '%s':\n'%s'", target_keyfile, key)
diff --git a/curtin/commands/block_meta_v2.py b/curtin/commands/block_meta_v2.py
index 3c6e1a5..3735975 100644
--- a/curtin/commands/block_meta_v2.py
+++ b/curtin/commands/block_meta_v2.py
@@ -1,12 +1,6 @@
 # This file is part of curtin. See LICENSE file for copyright and license info.
 
 import os
-from typing import (
-    List,
-    Optional,
-    )
-
-import attr
 
 from curtin import (block, util)
 from curtin.commands.block_meta import (
@@ -26,33 +20,28 @@ from curtin.storage_config import (
 from curtin.udev import udevadm_settle
 
 
-@attr.s(auto_attribs=True)
 class PartTableEntry:
-    # The order listed here matches the order sfdisk represents these fields
-    # when using the --dump argument.
-    number: int
-    start: int
-    size: int
-    type: str
-    uuid: Optional[str]
-    # name here is the sfdisk term - quoted descriptive text of the partition -
-    # not to be confused with what make_dname() does.
-    # Offered in the partition command as 'partition_name'.
-    name: Optional[str]
-    attrs: Optional[List[str]]
-    bootable: bool = False
+    def __init__(self, number, start, size, type, uuid=None, name=None,
+                 attrs=None, bootable=False):
+        self.number = number
+        self.start = start
+        self.size = size
+        self.type = type
+        self.uuid = uuid
+        self.name = name
+        self.attrs = attrs
+        self.bootable = bootable
 
     def render(self):
-        r = f'{self.number}: '
+        r = '{}: '.format(self.number)
         for a in 'start', 'size', 'type', 'uuid':
             v = getattr(self, a)
             if v is not None:
-                r += f' {a}={v}'
+                r += ' {}={}'.format(a, v)
         if self.name is not None:
-            r += f' name="{self.name}"'
+            r += ' name="{}"'.format(self.name)
         if self.attrs:
-            v = ' '.join(self.attrs)
-            r += f' attrs="{v}"'
+            r += ' attrs="{}"'.format(' '.join(self.attrs))
         if self.bootable:
             r += ' bootable'
         return r
@@ -82,7 +71,7 @@ def align_down(size, block_size):
 def resize_ext(path, size):
     util.subp(['e2fsck', '-p', '-f', path])
     size_k = size // 1024
-    util.subp(['resize2fs', path, f'{size_k}k'])
+    util.subp(['resize2fs', path, '{}k'.format(size_k)])
 
 
 def resize_ntfs(path, size):
@@ -347,7 +336,7 @@ def _prepare_resize(storage_config, part_action, table, part_info):
     format_actions = select_configs(storage_config, type='format',
                                     volume=volume)
     if len(format_actions) > 1:
-        raise Exception(f'too many format actions for volume {volume}')
+        raise Exception('too many format actions for volume {}'.format(volume))
 
     if len(format_actions) == 1:
         if not format_actions[0].get('preserve'):
diff --git a/curtin/commands/install.py b/curtin/commands/install.py
index 7ccad87..c0520b7 100644
--- a/curtin/commands/install.py
+++ b/curtin/commands/install.py
@@ -112,16 +112,17 @@ def writeline(fname, output):
         pass
 
 
-@attr.s(auto_attribs=True)
 class WorkingDir:
-    target: str
-    top: str
-    scratch: str
-    interfaces: str
-    netconf: str
-    netstate: str
-    fstab: str
-    config_file: str
+    def __init__(self, target, top, scratch, interfaces, netconf, netstate,
+                 fstab, config_file):
+        self.target = target
+        self.top = top
+        self.scratch = scratch
+        self.interfaces = interfaces
+        self.netconf = netconf
+        self.netstate = netstate
+        self.fstab = fstab
+        self.config_file = config_file
 
     @classmethod
     def import_existing(cls, config):
diff --git a/tools/vmtest-system-setup b/tools/vmtest-system-setup
index 4596df5..05f4c8e 100755
--- a/tools/vmtest-system-setup
+++ b/tools/vmtest-system-setup
@@ -21,7 +21,6 @@ DEPS=(
   make
   net-tools
   python3
-  python3-attr
   python3-jsonschema
   python3-nose
   python3-simplestreams

Follow ups