summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-05 11:30:31 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-05 11:30:31 +0000
commitf4c4400bb05b6acef7ccda720c49dba9260196ca (patch)
tree465365f05982db88fd5186641ce57a0cabce0904
parentff847a19f4cfc82c05d86fc8c5a8c6ef3a829843 (diff)
downloadimport-baserock/richardipsum/python_v2-before-rebase.tar.gz
Fix for case where project doesn't existbaserock/richardipsum/python_v2-before-rebase
-rw-r--r--exts/importer_pip_common.py2
-rwxr-xr-xexts/pip.find_deps10
-rwxr-xr-xexts/pip.to_lorry4
3 files changed, 13 insertions, 3 deletions
diff --git a/exts/importer_pip_common.py b/exts/importer_pip_common.py
index ac003b5..be8346d 100644
--- a/exts/importer_pip_common.py
+++ b/exts/importer_pip_common.py
@@ -60,7 +60,7 @@ def name_or_closest(client, package_name):
logging.debug('Filtered results: %s' % results)
- return results[0]['name']
+ return results[0]['name'] if len(results) > 0 else None
def find_releases(client, package_name):
diff --git a/exts/pip.find_deps b/exts/pip.find_deps
index 5bccbef..5e52d19 100755
--- a/exts/pip.find_deps
+++ b/exts/pip.find_deps
@@ -182,6 +182,9 @@ def resolve_versions(specsets):
# Bit of a hack to deal with pypi case insensitivity
new_proj_name = name_or_closest(client, proj_name)
+ if new_proj_name == None:
+ error("Couldn't find any project with name '%s'" % proj_name)
+
logging.debug("Treating %s as %s" % (proj_name, new_proj_name))
proj_name = new_proj_name
@@ -330,8 +333,11 @@ def main():
client = xmlrpclib.ServerProxy(PYPI_URL)
new_name = name_or_closest(client, name)
- if name != new_name:
- logging.debug('Treating %s as %s' % (name, new_name))
+
+ if new_name == None:
+ error("Couldn't find any project with name '%s'" % name)
+
+ logging.debug('Treating %s as %s' % (name, new_name))
name = new_name
deps = {}
diff --git a/exts/pip.to_lorry b/exts/pip.to_lorry
index 557b53e..451c9a7 100755
--- a/exts/pip.to_lorry
+++ b/exts/pip.to_lorry
@@ -204,6 +204,10 @@ def main():
# TODO: do not overwrite the original name, create a new attribute
# hurray for this dynamic language! >.>
new_proj_name = name_or_closest(client, req.project_name)
+
+ if new_proj_name == None:
+ error("Couldn't find any project with name '%s'" % req.project_name)
+
logging.debug('Treating %s as %s' % (req.project_name, new_proj_name))
req.project_name = new_proj_name