summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorJosh Dorothy <josh.dorothy@hp.com>2012-11-27 12:56:13 -0800
committerJosh Dorothy <josh.dorothy@hp.com>2012-11-27 16:44:43 -0800
commit7079d5054a3f0aa92bc09bb9d58437e03d92de7a (patch)
treeccb7cfe668f07df4f47c0a307405f408c8146fa0 /setup.py
parent52389f90f2167701802a7eee16b9b758fa600fe6 (diff)
downloadpython-troveclient-7079d5054a3f0aa92bc09bb9d58437e03d92de7a.tar.gz
Complying with
http://wiki.openstack.org/ProjectTestingInterface Fixes: bug 1083835 Change-Id: I31f525c62cdb3b4c7eb695b6a431e4df6443f673
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py45
1 files changed, 38 insertions, 7 deletions
diff --git a/setup.py b/setup.py
index 037af38..cbe59c8 100644
--- a/setup.py
+++ b/setup.py
@@ -17,15 +17,47 @@
# under the License.
import os
+import re
import setuptools
import sys
-requirements = ["httplib2", "lxml", "prettytable"]
-if sys.version_info < (2, 6):
- requirements.append("simplejson")
-if sys.version_info < (2, 7):
- requirements.append("argparse")
+# Get requirements from the first file that exists
+def get_reqs_from_files(requirements_files):
+ for requirements_file in requirements_files:
+ if os.path.exists(requirements_file):
+ with open(requirements_file, 'r') as fil:
+ return fil.read().split('\n')
+ return []
+
+
+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
+ # argparse is part of the standard library starting with 2.7
+ # adding it to the requirements list screws distro installs
+ elif line == 'argparse' and sys.version_info >= (2, 7):
+ pass
+ else:
+ requirements.append(line)
+
+ return requirements
def read_file(file_name):
@@ -41,8 +73,7 @@ setuptools.setup(
license="Apache License, Version 2.0",
url="https://github.com/openstack/python-reddwarfclient",
packages=["reddwarfclient"],
- install_requires=requirements,
- tests_require=["nose", "mock"],
+ install_requires=parse_requirements(),
test_suite="nose.collector",
classifiers=[
"Development Status :: 5 - Production/Stable",