Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Commit

Permalink
Migrate to pbr.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DinaBelova authored and fungi committed Aug 15, 2013
1 parent f93a719 commit d73c473
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 63 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Expand Up @@ -2,5 +2,10 @@ build
dist
git_review.egg-info
MANIFEST
AUTHORS
ChangeLog
.tox
requirements.txt
.venv
*.egg
*.egg-info
*.pyc
9 changes: 9 additions & 0 deletions .mailmap
@@ -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>
9 changes: 0 additions & 9 deletions AUTHORS

This file was deleted.

1 change: 1 addition & 0 deletions 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
Empty file added git_review/__init__.py
Empty file.
11 changes: 8 additions & 3 deletions git-review → git_review/cmd.py
Expand Up @@ -21,6 +21,7 @@
import datetime
import json
import os
import pkg_resources
import re
import shlex
import subprocess
Expand All @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
@@ -0,0 +1 @@
argparse
28 changes: 28 additions & 0 deletions 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
48 changes: 2 additions & 46 deletions setup.py
Expand Up @@ -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)
5 changes: 5 additions & 0 deletions test-requirements.txt
@@ -0,0 +1,5 @@
hacking>=0.5.6,<0.6
discover

testrepository>=0.0.13
testtools>=0.9.27
13 changes: 9 additions & 4 deletions tox.ini
Expand Up @@ -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]
Expand All @@ -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

0 comments on commit d73c473

Please sign in to comment.