diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2015-01-08 16:06:21 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2015-01-12 11:57:46 +0000 |
commit | ecf6dbb587b676405809f26657be4f2b5d8a55b7 (patch) | |
tree | 8f64e468fa9b03fbb83ef26daaddae72ee8141dd | |
parent | e8bf3d6e80cf3f29f7a07536eab68c32dcaf7f4b (diff) | |
download | import-ecf6dbb587b676405809f26657be4f2b5d8a55b7.tar.gz |
Use comparison callback in python importer
As well as being case insensitive project names on python treat '-' and '_'
as equivalent characters [1]
[1]: http://legacy.python.org/dev/peps/pep-0426/#name
-rw-r--r-- | baserockimport/app.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/baserockimport/app.py b/baserockimport/app.py index cd3203e..0b190e5 100644 --- a/baserockimport/app.py +++ b/baserockimport/app.py @@ -206,6 +206,10 @@ class BaserockImportApplication(cliapp.Application): def import_python(self, args): '''Import one or more python packages.''' + + def comp(x, y): + return x.replace('-', '_').lower() == y.replace('-', '_').lower() + if len(args) < 1 or len(args) > 2: raise cliapp.AppException( 'Please pass the name of the python package on the commandline.') @@ -218,5 +222,6 @@ class BaserockImportApplication(cliapp.Application): goal_kind='python', goal_name=package_name, goal_version=package_version) - loop.enable_importer('python', strata=['strata/core.morph']) + loop.enable_importer('python', strata=['strata/core.morph'], + package_comp_callback=comp) loop.run() |