Skip to contentSkip to conversation

scanpypi: fix Py2/3 conversion leftover

PATCH New yegorslists at googlemail.com 2 participants 4 messages Feb 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scanpypi: fix Py2/3 conversion leftover

From: Yegor Yefremov <[email protected]>

Use urlparse from six package.

---
 utils/scanpypi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/scanpypi +1 -1
index 12bfc24e10..1720c0c051 100755
@@ -188,7 +188,7 @@ class BuildrootPackage():
                 'md5_digest': None}]
             # In this case, we can't get the name of the downloaded file
             # from the pypi api, so we need to find it, this should work
-            urlpath = urllib2.urlparse.urlparse(
+            urlpath = six.moves.urllib.parse.urlparse(
                 self.metadata['info']['download_url']).path
             # urlparse().path give something like
             # /path/to/file-version.tar.gz
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/2 scanpypi: fix licence detection handling for unknown licences

From: Yegor Yefremov <[email protected]>

Check for match object not being None.

---
 utils/scanpypi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/scanpypi +1 -1
index 1720c0c051..14ee87784a 100755
@@ -436,7 +436,7 @@ class BuildrootPackage():
             for license_file in license_files:
                 with open(license_file) as lic_file:
                     match = liclookup.match(lic_file.read())
-                if match.confidence >= 90.0:
+                if match is not None and match.confidence >= 90.0:
                     license_names.append(match.license.id)
 
             if len(license_names) > 0:
Signature · 1 line
2.11.0