diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2015-01-08 10:48:52 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2015-01-08 10:48:52 +0000 |
commit | 5dfbc39b70b87dfe19d53142967c5ad40b55fe75 (patch) | |
tree | 88883f98ae99c3217fe9b461fb5db33d4a03c9b1 /baserockimport/exts | |
parent | bad7aca19f7068cb91df848d9387bb80c83ff198 (diff) | |
download | import-5dfbc39b70b87dfe19d53142967c5ad40b55fe75.tar.gz |
Pass local_data_path to python exts through argvbaserock/richardipsum/fix-lorry-bug-2
Diffstat (limited to 'baserockimport/exts')
-rw-r--r-- | baserockimport/exts/importer_python_common.py | 2 | ||||
-rwxr-xr-x | baserockimport/exts/python.find_deps | 8 | ||||
-rwxr-xr-x | baserockimport/exts/python.to_lorry | 7 |
3 files changed, 12 insertions, 5 deletions
diff --git a/baserockimport/exts/importer_python_common.py b/baserockimport/exts/importer_python_common.py index 8327678..e8e31db 100644 --- a/baserockimport/exts/importer_python_common.py +++ b/baserockimport/exts/importer_python_common.py @@ -96,4 +96,4 @@ class PythonExtension(ImportExtension): def process_args(self, _): import __main__ - __main__.main(sys.argv) + __main__.main(sys.argv + [self.local_data_path('python.yaml')]) diff --git a/baserockimport/exts/python.find_deps b/baserockimport/exts/python.find_deps index 792405b..e765f07 100755 --- a/baserockimport/exts/python.find_deps +++ b/baserockimport/exts/python.find_deps @@ -328,13 +328,17 @@ def find_runtime_deps(source, name, version=None, use_requirements_file=False): return runtime_deps def main(argv): - if len(argv) not in [3, 4]: - print('usage: %s PACKAGE_SOURCE_DIR NAME [VERSION]' % argv[0]) + if len(argv) not in [3, 4, 5]: + print('usage: %s PACKAGE_SOURCE_DIR NAME [VERSION] [local_data_path]' + % argv[0]) sys.exit(1) logging.debug('%s: argv[1:]: %s' % (argv[0], argv[1:])) source, name = argv[1:3] version = argv[3] if len(argv) == 4 else None + local_data_path = argv[4] if len(argv) == 5 else None + + logging.debug('local_data_path find_deps: %s\n', local_data_path) client = xmlrpclib.ServerProxy(PYPI_URL) new_name = name_or_closest(client, name) diff --git a/baserockimport/exts/python.to_lorry b/baserockimport/exts/python.to_lorry index f54e341..48367fb 100755 --- a/baserockimport/exts/python.to_lorry +++ b/baserockimport/exts/python.to_lorry @@ -188,16 +188,19 @@ def str_repo_lorry(package_name, repo_type, url): indent=4, sort_keys=True) def main(argv): - if len(argv) != 2: + if len(argv) not in [2, 3]: # TODO explain the format of python requirements # warn the user that they probably want to quote their arg # > < will be interpreted as redirection by the shell - print('usage: %s requirement' % argv[0], file=sys.stderr) + print('usage: %s requirement [local_data_path]' % argv[0], file=sys.stderr) sys.exit(1) client = xmlrpclib.ServerProxy(PYPI_URL) req = pkg_resources.parse_requirements(argv[1]).next() + local_data_path = argv[2] if len(argv) == 3 else None + + logging.debug('local_data_path to_lorry: %s\n', local_data_path) new_proj_name = name_or_closest(client, req.project_name) |