[2/2] package-manager: pylint fixes

Message ID 20181214010848.24170-2-ross.burton@intel.com
State New
Headers show
Series
  • [1/2] package_manager: don't search for binaries in $PATH explicitly
Related show

Commit Message

Ross Burton Dec. 14, 2018, 1:08 a.m.
mark_packages() is implicitly abstract in OpkgDpkgPM so implement it for
clarity.

Also trivial whitespace, semicolons, unused variables, and regex strings.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/lib/oe/package_manager.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index f0d98dd0ffc..564b74ae7b5 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -29,7 +29,7 @@  def opkg_query(cmd_output):
     a dictionary with the information of the packages. This is used
     when the packages are in deb or ipk format.
     """
-    verregex = re.compile(' \([=<>]* [^ )]*\)')
+    verregex = re.compile(r" \([=<>]* [^ )]*\)")
     output = dict()
     pkg = ""
     arch = ""
@@ -237,9 +237,9 @@  class DpkgIndexer(Indexer):
         bb.utils.mkdirhier(os.path.join(self.apt_conf_dir, "apt.conf.d"))
         bb.utils.mkdirhier(os.path.join(self.apt_conf_dir, "preferences.d"))
 
-        with open(os.path.join(self.apt_conf_dir, "preferences"), "w") as prefs_file:
+        with open(os.path.join(self.apt_conf_dir, "preferences"), "w"):
             pass
-        with open(os.path.join(self.apt_conf_dir, "sources.list"), "w+") as sources_file:
+        with open(os.path.join(self.apt_conf_dir, "sources.list"), "w+"):
             pass
 
         with open(self.apt_conf_file, "w") as apt_conf:
@@ -1118,6 +1118,10 @@  class OpkgDpkgPM(PackageManager):
 
         return tmp_dir
 
+    @abstractmethod
+    def mark_packages(self, status_tag, packages=None):
+        pass
+
     def _handle_intercept_failure(self, registered_pkgs):
         self.mark_packages("unpacked", registered_pkgs.split())
 
@@ -1633,13 +1637,13 @@  class DpkgPM(OpkgDpkgPM):
         # rename *.dpkg-new files/dirs
         for root, dirs, files in os.walk(self.target_rootfs):
             for dir in dirs:
-                new_dir = re.sub("\.dpkg-new", "", dir)
+                new_dir = re.sub(r"\.dpkg-new", "", dir)
                 if dir != new_dir:
                     os.rename(os.path.join(root, dir),
                               os.path.join(root, new_dir))
 
             for file in files:
-                new_file = re.sub("\.dpkg-new", "", file)
+                new_file = re.sub(r"\.dpkg-new", "", file)
                 if file != new_file:
                     os.rename(os.path.join(root, file),
                               os.path.join(root, new_file))
@@ -1744,11 +1748,10 @@  class DpkgPM(OpkgDpkgPM):
                                    os.path.join(self.deploy_dir, arch))
 
         base_arch_list = base_archs.split()
-        multilib_variants = self.d.getVar("MULTILIB_VARIANTS");
+        multilib_variants = self.d.getVar("MULTILIB_VARIANTS")
         for variant in multilib_variants.split():
             localdata = bb.data.createCopy(self.d)
             variant_tune = localdata.getVar("DEFAULTTUNE_virtclass-multilib-" + variant, False)
-            orig_arch = localdata.getVar("DPKG_ARCH")
             localdata.setVar("DEFAULTTUNE", variant_tune)
             variant_arch = localdata.getVar("DPKG_ARCH")
             if variant_arch not in base_arch_list:
@@ -1762,7 +1765,7 @@  class DpkgPM(OpkgDpkgPM):
                     if match_arch:
                         for base_arch in base_arch_list:
                             architectures += "\"%s\";" % base_arch
-                        apt_conf.write("  Architectures {%s};\n" % architectures);
+                        apt_conf.write("  Architectures {%s};\n" % architectures)
                         apt_conf.write("  Architecture \"%s\";\n" % base_archs)
                     else:
                         line = re.sub("#ROOTFS#", self.target_rootfs, line)