diff --git a/.gitignore b/.gitignore index 51d262ab..8bb23235 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build dist git_review.egg-info MANIFEST +.tox diff --git a/HACKING b/HACKING new file mode 100644 index 00000000..5ccb530b --- /dev/null +++ b/HACKING @@ -0,0 +1,16 @@ +Development of git-review is managed by OpenStack's Gerrit, which can be +found at https://review.openstack.org + +Instructions on submitting patches can be found at +http://wiki.openstack.org/GerritWorkflow + +git-review should, in general, not depend on a huge number of external +libraries, so that installing it is a lightweight operation. + +All code should be pep8-compliant. It won't merge otherwise. + +A tox config file has been added for easy local testing. Just run: + + tox + +And it will check the code for you. diff --git a/MANIFEST.in b/MANIFEST.in index aded1ca7..ace5867b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ +include requirements.txt include README.md include LICENSE include AUTHORS diff --git a/git-review b/git-review index b895d16b..fc7fa806 100755 --- a/git-review +++ b/git-review @@ -16,7 +16,6 @@ implied. See the License for the specific language governing permissions and limitations under the License.""" -import argparse import urllib import json @@ -550,6 +549,8 @@ def main(): config = get_config() usage = "git review [OPTIONS] ... [BRANCH]" + + import argparse parser = argparse.ArgumentParser(usage=usage, description=COPYRIGHT) parser.add_argument("-t", "--topic", dest="topic", diff --git a/setup.py b/setup.py index eabf161d..c0bdad15 100755 --- a/setup.py +++ b/setup.py @@ -33,6 +33,28 @@ class git_review_install(install): git_review_cmdclass = {'install': git_review_install} +def parse_requirements(file_name): + requirements = [] + for line in open(file_name, 'r').read().split('\n'): + if re.match(r'(\s*#)|(\s*$)', line): + continue + if re.match(r'\s*-e\s+', line): + requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line)) + elif re.match(r'\s*-f\s+', line): + pass + else: + requirements.append(line) + + return requirements + +def parse_dependency_links(file_name): + dependency_links = [] + for line in open(file_name, 'r').read().split('\n'): + if re.match(r'\s*-[ef]\s+', line): + dependency_links.append(re.sub(r'\s*-[ef]\s+', '', line)) + + return dependency_links + setup( name='git-review', version=version, @@ -46,4 +68,6 @@ setup( url='https://launchpad.net/git-review', scripts=['git-review'], data_files=[('share/man/man1', ['git-review.1'])], + install_requires=parse_requirements('requirements.txt'), + dependency_links=parse_dependency_links('requirements.txt'), ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..af9e1009 --- /dev/null +++ b/tox.ini @@ -0,0 +1,8 @@ +[tox] +envlist = py26,py27 + +[testenv] +#deps = -r{toxinidir}/tools/pip-requires +deps = pep8 +commands = pep8 git-review +