scanpypi: ignore empty elements in package requirements
authorYegor Yefremov <yegorslists@googlemail.com>
Fri, 26 Jan 2018 12:54:06 +0000 (13:54 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Fri, 26 Jan 2018 13:43:28 +0000 (14:43 +0100)
Depending on how setup.py reads requirements files empty elements can occur.
This patch takes care, that such elements will be ignored and don't crash
the scanpypi script.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Tested-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
utils/scanpypi

index 88fcb4a8a6f3ce07b14ff279058e946756412f04..23a2fb8c7bd47dbd1843a6220c3c346717475d9a 100755 (executable)
@@ -295,7 +295,8 @@ class BuildrootPackage():
                         for req in self.pkg_req]
 
         # get rid of commented lines and also strip the package strings
-        self.pkg_req = [item.strip() for item in self.pkg_req if item[0] != '#']
+        self.pkg_req = [item.strip() for item in self.pkg_req
+                        if len(item) > 0 and item[0] != '#']
 
         req_not_found = self.pkg_req
         self.pkg_req = map(pkg_buildroot_name, self.pkg_req)