Migrate to pbr.

For ease of future source code maintenance by OpenStack developers,
git-review is now adopting the same Python Build Reasonableness as
used by current OpenStack projects.

Closes-Bug: 1179007
Change-Id: I20427b51e84b90dcc1d870a547cdcc5240b4ff0e
This commit is contained in:
Dina Belova 2013-07-03 17:49:34 +04:00 committed by Jeremy Stanley
parent f93a719a10
commit d73c473b19
11 changed files with 69 additions and 63 deletions

7
.gitignore vendored
View File

@ -2,5 +2,10 @@ build
dist dist
git_review.egg-info git_review.egg-info
MANIFEST MANIFEST
AUTHORS
ChangeLog
.tox .tox
requirements.txt .venv
*.egg
*.egg-info
*.pyc

9
.mailmap Normal file
View File

@ -0,0 +1,9 @@
# Format is:
# <preferred e-mail> <other e-mail 1>
# <preferred e-mail> <other e-mail 2>
David Ostrovsky <david@ostrovsky.org> <David.Ostrovsky@gmx.de>
David Ostrovsky <david@ostrovsky.org> <david.ostrovsky@gmx.de>
James E. Blair <james.blair@rackspace.com> <jeblair@openstack.org>
James E. Blair <james.blair@rackspace.com> <corvus@inaugust.com>
James E. Blair <james.blair@rackspace.com> <jeblair@hp.com>

View File

@ -1,9 +0,0 @@
Monty Taylor <mordred@inaugust.com>
James E. Blair <james.blair@rackspace.com>
Saggi Mizrahi <smizrahi@redhat.com>
Kiall Mac Innes <kiall@managedit.ie>
Roan Kattouw <roan.kattouw@gmail.com>
Antoine Musso <hashar@free.fr>
Yuriy Taraday <yorik.sar@gmail.com>
Pavel Sedlák <psedlak@redhat.com>
Ori Livneh <ori@wikimedia.org>

View File

@ -1,6 +1,7 @@
include README.rst include README.rst
include LICENSE include LICENSE
include AUTHORS include AUTHORS
include ChangeLog
include HACKING.rst include HACKING.rst
include git-review.1 include git-review.1
include tox.ini include tox.ini

0
git_review/__init__.py Normal file
View File

View File

@ -21,6 +21,7 @@ limitations under the License."""
import datetime import datetime
import json import json
import os import os
import pkg_resources
import re import re
import shlex import shlex
import subprocess import subprocess
@ -42,8 +43,6 @@ else:
urlparse = urllib.parse.urlparse urlparse = urllib.parse.urlparse
do_input = input do_input = input
version = "1.23"
VERBOSE = False VERBOSE = False
UPDATE = False UPDATE = False
CONFIGDIR = os.path.expanduser("~/.config/git-review") CONFIGDIR = os.path.expanduser("~/.config/git-review")
@ -145,6 +144,12 @@ def run_command_exc(klazz, *argv, **env):
return output return output
def get_version():
requirement = pkg_resources.Requirement.parse('git-review')
provider = pkg_resources.get_provider(requirement)
return provider.version
def git_directories(): def git_directories():
"""Determine (absolute git work directory path, .git subdirectory path).""" """Determine (absolute git work directory path, .git subdirectory path)."""
cmd = ("git", "rev-parse", "--show-toplevel", "--git-dir") cmd = ("git", "rev-parse", "--show-toplevel", "--git-dir")
@ -1004,7 +1009,7 @@ def main():
help="Print the license and exit") help="Print the license and exit")
parser.add_argument("--version", action="version", parser.add_argument("--version", action="version",
version='%s version %s' % 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="?") parser.add_argument("branch", nargs="?")
try: try:

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
argparse

28
setup.cfg Normal file
View File

@ -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

View File

@ -14,52 +14,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from distutils.command import install as du_install
import os.path
import setuptools 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): setuptools.setup(setup_requires=['pbr>=0.5.21,<1.0'],
# Force single-version-externally-managed pbr=True)
# 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'],
)

5
test-requirements.txt Normal file
View File

@ -0,0 +1,5 @@
hacking>=0.5.6,<0.6
discover
testrepository>=0.0.13
testtools>=0.9.27

13
tox.ini
View File

@ -2,11 +2,17 @@
envlist = py26,py27,pep8 envlist = py26,py27,pep8
[testenv] [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] [testenv:pep8]
deps = argparse
hacking<0.6
commands = flake8 commands = flake8
[testenv:sdist] [testenv:sdist]
@ -19,4 +25,3 @@ commands = {posargs}
ignore = E125 ignore = E125
show-source = True show-source = True
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
filename = git-review,setup.py