summaryrefslogtreecommitdiffstats
path: root/openstack/common/setup.py
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2012-05-25 11:39:00 -0400
committerMonty Taylor <mordred@inaugust.com>2012-05-25 17:35:00 -0400
commitf96acd8a9f0cef80b6e0eb2f9cf980702bba4043 (patch)
treea617b0d303dcab5c4edadfc08e99a510c20f7ae7 /openstack/common/setup.py
parent36b5f6eec98a4042b17a2645d8947ffd4c1aee14 (diff)
downloadoslo-f96acd8a9f0cef80b6e0eb2f9cf980702bba4043.tar.gz
oslo-f96acd8a9f0cef80b6e0eb2f9cf980702bba4043.tar.xz
oslo-f96acd8a9f0cef80b6e0eb2f9cf980702bba4043.zip
Added support for proper bare URLs.
If we want to use github zipballs as a source of depends sometimes (which we do) - we need to have the pip-requires parsing understand that lines starting with http:// or https:// are urls and should go to dependency_links. Change-Id: I9218159872d6edfebd4b820e6db912e9aabdf7d7
Diffstat (limited to 'openstack/common/setup.py')
-rw-r--r--openstack/common/setup.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/openstack/common/setup.py b/openstack/common/setup.py
index 50c59db..79b5a62 100644
--- a/openstack/common/setup.py
+++ b/openstack/common/setup.py
@@ -61,9 +61,19 @@ def parse_requirements(requirements_files=['requirements.txt',
'tools/pip-requires']):
requirements = []
for line in get_reqs_from_files(requirements_files):
+ # For the requirements list, we need to inject only the portion
+ # after egg= so that distutils knows the package it's looking for
+ # such as:
+ # -e git://github.com/openstack/nova/master#egg=nova
if re.match(r'\s*-e\s+', line):
requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1',
line))
+ # such as:
+ # http://github.com/openstack/nova/zipball/master#egg=nova
+ elif re.match(r'\s*https?:', line):
+ requirements.append(re.sub(r'\s*https?:.*#egg=(.*)$', r'\1',
+ line))
+ # -f lines are for index locations, and don't get used here
elif re.match(r'\s*-f\s+', line):
pass
else:
@@ -75,11 +85,18 @@ def parse_requirements(requirements_files=['requirements.txt',
def parse_dependency_links(requirements_files=['requirements.txt',
'tools/pip-requires']):
dependency_links = []
+ # dependency_links inject alternate locations to find packages listed
+ # in requirements
for line in get_reqs_from_files(requirements_files):
+ # skip comments and blank lines
if re.match(r'(\s*#)|(\s*$)', line):
continue
+ # lines with -e or -f need the whole line, minus the flag
if re.match(r'\s*-[ef]\s+', line):
dependency_links.append(re.sub(r'\s*-[ef]\s+', '', line))
+ # lines that are only urls can go in unmolested
+ elif re.match(r'\s*https?:', line):
+ dependency_links.append(line)
return dependency_links