diff --git a/.gitignore b/.gitignore index 7e27b2c..f75e8ea 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,10 @@ build dist git_review.egg-info MANIFEST +AUTHORS +ChangeLog .tox -requirements.txt +.venv +*.egg +*.egg-info +*.pyc diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..9757c06 --- /dev/null +++ b/.mailmap @@ -0,0 +1,9 @@ +# Format is: +# +# + +David Ostrovsky +David Ostrovsky +James E. Blair +James E. Blair +James E. Blair diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index e9d54cf..0000000 --- a/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -Monty Taylor -James E. Blair -Saggi Mizrahi -Kiall Mac Innes -Roan Kattouw -Antoine Musso -Yuriy Taraday -Pavel Sedlák -Ori Livneh diff --git a/MANIFEST.in b/MANIFEST.in index 8d4abe0..21636ab 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ include README.rst include LICENSE include AUTHORS +include ChangeLog include HACKING.rst include git-review.1 include tox.ini diff --git a/git_review/__init__.py b/git_review/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/git-review b/git_review/cmd.py similarity index 99% rename from git-review rename to git_review/cmd.py index e7557f5..1126a2b 100755 --- a/git-review +++ b/git_review/cmd.py @@ -21,6 +21,7 @@ import datetime import json import os +import pkg_resources import re import shlex import subprocess @@ -42,8 +43,6 @@ urlparse = urllib.parse.urlparse do_input = input -version = "1.23" - VERBOSE = False UPDATE = False CONFIGDIR = os.path.expanduser("~/.config/git-review") @@ -145,6 +144,12 @@ def run_command_exc(klazz, *argv, **env): return output +def get_version(): + requirement = pkg_resources.Requirement.parse('git-review') + provider = pkg_resources.get_provider(requirement) + return provider.version + + def git_directories(): """Determine (absolute git work directory path, .git subdirectory path).""" cmd = ("git", "rev-parse", "--show-toplevel", "--git-dir") @@ -1004,7 +1009,7 @@ def __call__(self, parser, namespace, values, option_string=None): help="Print the license and exit") parser.add_argument("--version", action="version", version='%s version %s' % - (os.path.split(sys.argv[0])[-1], version)) + (os.path.split(sys.argv[0])[-1], get_version())) parser.add_argument("branch", nargs="?") try: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1352d5e --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +argparse diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..6c82bba --- /dev/null +++ b/setup.cfg @@ -0,0 +1,28 @@ +[metadata] +name = git-review +summary = Tool to submit code to Gerrit +description-file = README.rst +license = Apache License (2.0) +classifiers = + Programming Language :: Python :: 2 + Programming Language :: Python :: 3 + Programming Language :: Python + Development Status :: 5 - Production/Stable + Environment :: Console + Environment :: OpenStack + Intended Audience :: Developers + Intended Audience :: Information Technology + License :: OSI Approved :: Apache Software License + Operating System :: OS Independent +keywords = git gerrit review +author = OpenStack +author-email = openstack-infra@lists.openstack.org +home-page = https://pypi.python.org/pypi/git-review + +[files] +packages = + git_review + +[entry_points] +console_scripts = + git-review = git_review.cmd:main diff --git a/setup.py b/setup.py index 2b1de91..ce12df3 100755 --- a/setup.py +++ b/setup.py @@ -14,52 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from distutils.command import install as du_install -import os.path import setuptools -from setuptools.command import install -import sys -version = None -# version comes from git-review. -savename = __name__ -__name__ = "not-main" -exec(open("git-review").read()) -__name__ = savename - -class git_review_install(install.install): - # Force single-version-externally-managed - # This puts the manpage in the right location (instead of buried - # in an egg) - def run(self): - return du_install.install.run(self) - -git_review_cmdclass = {'install': git_review_install} - -manpath = 'share/man' -if os.path.exists(os.path.join(sys.prefix, 'man')): - # This works around a bug with install where it expects every node - # in the relative data directory to be an actual directory, since at - # least Debian derivatives (and probably other platforms as well) - # like to symlink Unixish /usr/local/man to /usr/local/share/man. - manpath = 'man' - -setuptools.setup( - name='git-review', - version=version, - cmdclass=git_review_cmdclass, - description="Tool to submit code to Gerrit", - license='Apache License (2.0)', - classifiers=[ - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 3", - ], - keywords='git gerrit review', - author='OpenStack, LLC.', - author_email='openstack@lists.launchpad.net', - url='https://launchpad.net/git-review', - scripts=['git-review'], - data_files=[(os.path.join(manpath, 'man1'), ['git-review.1'])], - install_requires=['argparse'], -) +setuptools.setup(setup_requires=['pbr>=0.5.21,<1.0'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..1410633 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,5 @@ +hacking>=0.5.6,<0.6 +discover + +testrepository>=0.0.13 +testtools>=0.9.27 diff --git a/tox.ini b/tox.ini index a88a585..9c61dd8 100644 --- a/tox.ini +++ b/tox.ini @@ -2,11 +2,17 @@ envlist = py26,py27,pep8 [testenv] -setenv = VIRTUAL_ENV={envdir} +setenv = + VIRTUAL_ENV={envdir} + LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=C + +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt [testenv:pep8] -deps = argparse - hacking<0.6 commands = flake8 [testenv:sdist] @@ -19,4 +25,3 @@ commands = {posargs} ignore = E125 show-source = True exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build -filename = git-review,setup.py