aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGravatar James Hilliard <james.hilliard1@gmail.com>2019-02-24 11:01:36 +0800
committerGravatar Peter Korsgaard <peter@korsgaard.com>2019-03-01 12:37:48 +0100
commitf13b843e710b570f77abd13ea990f61fe2800f52 (patch)
treec143c2315068d75c3fd69a5c9a78437ab579e261 /utils
parenta21212fb7cf4868b2f00d1aa22861f6103fab979 (diff)
downloadbuildroot-f13b843e710b570f77abd13ea990f61fe2800f52.tar.gz
buildroot-f13b843e710b570f77abd13ea990f61fe2800f52.tar.bz2
utils/scanpypi: handle underscores in python packages
Some python packages seem to use underscores in inconsistent ways. We can attempt to normalize these by always using dashes for the buildroot name and attempting to autodetect the correct metadata name format. Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/scanpypi7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/scanpypi b/utils/scanpypi
index bdce6924b6..55b3d1e61c 100755
--- a/utils/scanpypi
+++ b/utils/scanpypi
@@ -97,6 +97,7 @@ def pkg_buildroot_name(pkg_name):
pkg_name -- String to rename
"""
name = re.sub('[^\w-]', '', pkg_name.lower())
+ name = name.replace('_', '-')
prefix = 'python-'
pattern = re.compile('^(?!' + prefix + ')(.+?)$')
name = pattern.sub(r'python-\1', name)
@@ -299,6 +300,12 @@ class BuildrootPackage():
sys.path.append(self.tmp_extract)
s_file, s_path, s_desc = imp.find_module('setup', [self.tmp_extract])
setup = imp.load_module('setup', s_file, s_path, s_desc)
+ if self.metadata_name in self.setup_args:
+ pass
+ elif self.metadata_name.replace('_', '-') in self.setup_args:
+ self.metadata_name = self.metadata_name.replace('_', '-')
+ elif self.metadata_name.replace('-', '_') in self.setup_args:
+ self.metadata_name = self.metadata_name.replace('-', '_')
try:
self.setup_metadata = self.setup_args[self.metadata_name]
except KeyError: