Complying with
http://wiki.openstack.org/ProjectTestingInterface Fixes: bug 1083835 Change-Id: I31f525c62cdb3b4c7eb695b6a431e4df6443f673
This commit is contained in:
		
							
								
								
									
										45
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								setup.py
									
									
									
									
									
								
							| @@ -17,15 +17,47 @@ | |||||||
| #    under the License. | #    under the License. | ||||||
|  |  | ||||||
| import os | import os | ||||||
|  | import re | ||||||
| import setuptools | import setuptools | ||||||
| import sys | import sys | ||||||
|  |  | ||||||
|  |  | ||||||
| requirements = ["httplib2", "lxml", "prettytable"] | # Get requirements from the first file that exists | ||||||
| if sys.version_info < (2, 6): | def get_reqs_from_files(requirements_files): | ||||||
|     requirements.append("simplejson") |     for requirements_file in requirements_files: | ||||||
| if sys.version_info < (2, 7): |         if os.path.exists(requirements_file): | ||||||
|     requirements.append("argparse") |             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): | def read_file(file_name): | ||||||
| @@ -41,8 +73,7 @@ setuptools.setup( | |||||||
|     license="Apache License, Version 2.0", |     license="Apache License, Version 2.0", | ||||||
|     url="https://github.com/openstack/python-reddwarfclient", |     url="https://github.com/openstack/python-reddwarfclient", | ||||||
|     packages=["reddwarfclient"], |     packages=["reddwarfclient"], | ||||||
|     install_requires=requirements, |     install_requires=parse_requirements(), | ||||||
|     tests_require=["nose", "mock"], |  | ||||||
|     test_suite="nose.collector", |     test_suite="nose.collector", | ||||||
|     classifiers=[ |     classifiers=[ | ||||||
|         "Development Status :: 5 - Production/Stable", |         "Development Status :: 5 - Production/Stable", | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								tools/pip-requires
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tools/pip-requires
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | argparse>=1.2.1 | ||||||
|  | httplib2>=0.7.7 | ||||||
|  | lxml>=3.0.1 | ||||||
|  | prettytable>=0.6.1 | ||||||
							
								
								
									
										6
									
								
								tools/test-requires
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tools/test-requires
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | nose>=1.2.1 | ||||||
|  | nosexcover>=1.0.7 | ||||||
|  | openstack.nose_plugin>=0.11 | ||||||
|  | pep8==1.1 | ||||||
|  | sphinx>=1.1.2 | ||||||
|  | unittest2>=0.5.1 | ||||||
							
								
								
									
										28
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								tox.ini
									
									
									
									
									
								
							| @@ -1,16 +1,24 @@ | |||||||
| # Python Reddwarf Client | # Python Reddwarf Client | ||||||
|  |  | ||||||
| [tox] | [tox] | ||||||
| envlist = py26, docs | envlist = py26,py27,pep8 | ||||||
|  |  | ||||||
| [testenv:docs] | [testenv] | ||||||
| deps = | setenv = VIRTUAL_ENV={envdir} | ||||||
|     coverage |          NOSE_WITH_OPENSTACK=1 | ||||||
|     httplib2 |          NOSE_OPENSTACK_COLOR=1 | ||||||
|     sphinx |          NOSE_OPENSTACK_RED=0.05 | ||||||
| commands = |          NOSE_OPENSTACK_YELLOW=0.025 | ||||||
|     sphinx-build -b doctest {toxinidir}/docs/source {envtmpdir}/html |          NOSE_OPENSTACK_SHOW_ELAPSED=1 | ||||||
|     sphinx-build -b html {toxinidir}/docs/source {envtmpdir}/html | deps = -r{toxinidir}/tools/pip-requires | ||||||
|  |        -r{toxinidir}/tools/test-requires | ||||||
|  | commands = nosetests | ||||||
|  |  | ||||||
| [testenv:pep8] | [testenv:pep8] | ||||||
| commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc reddwarfclient setup.py | commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc reddwarfclient setup.py | ||||||
|  |  | ||||||
|  | [testenv:venv] | ||||||
|  | commands = {posargs} | ||||||
|  |  | ||||||
|  | [testenv:cover] | ||||||
|  | commands = nosetests --cover-erase --cover-package=reddwarfclient --with-xcoverage | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Josh Dorothy
					Josh Dorothy