From 942de1ae2e7d9fcfa09b4efe6e7604ef87326f60 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 15 Mar 2014 08:37:18 -0700 Subject: [PATCH] Prepared for upstream integration Migrate build to pbr. Add tox.ini file. Removed debian dir. --- .gitignore | 8 +--- .gitreview | 4 +- create_manpage.py | 3 +- debian/changelog | 5 -- debian/compat | 1 - debian/control | 25 ---------- debian/copyright | 43 ----------------- debian/docs | 1 - debian/rules | 17 ------- functional-tests/040-test_simple_rebase.sh | 20 ++++---- functional-tests/README.md | 5 +- git_upstream/main.py | 2 +- requirements.txt | 4 ++ setup.cfg | 33 ++++++++++++- setup.py | 54 ++-------------------- test-requirements.txt | 9 ++++ tox.ini | 31 +++++++++++++ 17 files changed, 98 insertions(+), 167 deletions(-) delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/docs delete mode 100755 debian/rules create mode 100644 requirements.txt create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index e4013fd..5b4f67b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,3 @@ -# Packaging -debian/files -debian/*.substvars -debian/*.debhelper.log -debian/*/* - # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -57,4 +51,4 @@ docs/_build/ # IDE .idea -.settings \ No newline at end of file +.settings diff --git a/.gitreview b/.gitreview index 8f50f5a..eaecdb1 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] -host=gerrit.hpcloud.net +host=review.openstack.org port=29418 -project=automation/git-upstream.git +project=openstack-infra/git-upstream.git diff --git a/create_manpage.py b/create_manpage.py index d1dec64..114a9b3 100644 --- a/create_manpage.py +++ b/create_manpage.py @@ -19,13 +19,13 @@ import datetime import argparse -from distutils.command.build import build from distutils.core import Command class CreateManpage(Command): user_options = [] + command_name = 'create_manpage' def initialize_options(self): from git_upstream import main @@ -129,4 +129,3 @@ class ManPageFormatter(argparse.ArgumentDefaultsHelpFormatter): def format_usage(self, usage): return ManPageFormatter._markup(usage) - diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 27dc1a8..0000000 --- a/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -git-upstream (1.0.0) First public release; urgency=low - - * First public hp-upstream release - - -- Davide Guerri Fri, 3 Mar 2014 13:21:30 +0000 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7f8f011..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/debian/control b/debian/control deleted file mode 100644 index e96480d..0000000 --- a/debian/control +++ /dev/null @@ -1,25 +0,0 @@ -Source: git-upstream -Section: vcs -Priority: optional -Maintainer: Davide Guerri -Build-Depends: debhelper (>= 7.0.50~), - python-all-dev (>= 2.6.6-3~) -Build-Depends-Indep: python-git, - python-setuptools -XS-Python-Version: >=2.6 -Standards-Version: 3.9.3 - -Package: git-upstream -Architecture: all -Section: python -XB-Python-Version: ${python:Versions} -Depends: python-git - ${shlibs:Depends}, - ${misc:Depends}, - ${python:Depends} -Provides: ${python:Provides} -Description: Git extensions which ease the rebasing of local-carried patches - on top of upstream repositories. - Git extensions to provide high-level abstraction for complex operations - that support the rebasing of local-carried patches on top of upstream - repositories. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index e6ccd63..0000000 --- a/debian/copyright +++ /dev/null @@ -1,43 +0,0 @@ -Format: http://dep.debian.net/deps/dep5 -Source: https://xxx - -Files: * -Copyright (c) 2012, 2013, 2014 Hewlett-Packard Development Company, L.P. -License: Apache-2 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied. - See the License for the specific language governing permissions and - limitations under the License. - . - On Debian-based systems the full text of the Apache version 2.0 license - can be found in `/usr/share/common-licenses/Apache-2.0'. - -Files: git_upstream/subcommand.py git_upstream/version.py git_upstream/commands/__init__.py -Copyright: 2011, 2012 OpenStack LLC. -License: Apache-2 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - . - On Debian-based systems the full text of the Apache version 2.0 license - can be found in `/usr/share/common-licenses/Apache-2.0'. -Comment: - In the case of git_upstream/version.py and git_upstream/commands/__init__.py only part of - the files are copyright, and as such are marked inline as being taken - from another project. diff --git a/debian/docs b/debian/docs deleted file mode 100644 index e845566..0000000 --- a/debian/docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/debian/rules b/debian/rules deleted file mode 100755 index f78f50b..0000000 --- a/debian/rules +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -%: - dh $@ --with python2 - -override_dh_auto_clean: - dh_auto_clean - rm -rf build/ diff --git a/functional-tests/040-test_simple_rebase.sh b/functional-tests/040-test_simple_rebase.sh index 7010389..d152685 100755 --- a/functional-tests/040-test_simple_rebase.sh +++ b/functional-tests/040-test_simple_rebase.sh @@ -26,21 +26,19 @@ function test_simple_rebase() { log DEBUG "Creating a local patch" cat </dev/null || return 1 log DEBUG "Cherry picking upstream commits" diff --git a/functional-tests/README.md b/functional-tests/README.md index 565e2bc..1d768ad 100644 --- a/functional-tests/README.md +++ b/functional-tests/README.md @@ -58,7 +58,8 @@ TEST_DIR Testing directory. Objects pertaining a test should be TEST_NAME The name of current test. Extracted from the test filename. prepare_for_git_upstream() Using the current git-upstream repo, create an - initial onfiguration useful for testing hp-git. + initial configuration useful for testing + git-upstream. After invoking it a "$TEST_DIR/$REPO_NAME" ## Environment variable used by the test framework @@ -68,4 +69,4 @@ VERBOSITY Set tests verbosity. Valid verbosities are: LEAVE_DIR If equals to "yes", testing framework won't remove testing directory. Useful for debugging and to inspect tests - results. \ No newline at end of file + results. diff --git a/git_upstream/main.py b/git_upstream/main.py index 5f135b9..a484b3a 100644 --- a/git_upstream/main.py +++ b/git_upstream/main.py @@ -17,7 +17,7 @@ """ -Command-line tool for the HP Cloud workflow +Command-line tool for tracking upstream revisions Main parser module, which after parsing the top level options will hand off to the collected subcommands parsers. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4e36e7b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +pbr>=0.5.21,<1.0 + +argcomplete +GitPython>=0.3.2.RC1 diff --git a/setup.cfg b/setup.cfg index 700c19b..d6a3a2e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,33 @@ -[easy_install] +[metadata] +name = git-upstream +author = Darragh Bailey +author-email = dbailey@hp.com +maintainer = Davide Guerri +maintainer-email = davide.guerri@hp.com +home-page = https://pypi.python.org/pypi/git-upstream +summary = git tool to help manage upstream repositories +description-file = README +license = Apache License (2.0) +keywords = git upstream workflow +classifiers = + Programming Language :: Python :: 2 + Programming Language :: Python :: 3 + Programming Language :: Python + Development Status :: 4 - Beta + Environment :: Console + Environment :: OpenStack + Intended Audience :: Developers + Intended Audience :: Information Technology + License :: OSI Approved :: Apache Software License + Operating System :: OS Independent +[global] +commands = create_manpage.CreateManpage + +[files] +packages = + git_upstream + +[entry_points] +console_scripts = + git-upstream = git_upstream.main:main diff --git a/setup.py b/setup.py index 66c78ed..6053675 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -# -# Copyright (c) 2012, 2013, 2014 Hewlett-Packard Development Company, L.P. +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,53 +13,10 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -# -import os -from setuptools import setup, find_packages -from create_manpage import CreateManpage -from git_upstream import version +import setuptools -# following function is taken from setuptools example. -# https://pypi.python.org/pypi/an_example_pypi_project (BSD) -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - -version.write_version_file() - -setup( - name="git-upstream", - version=version.version, - author="Darragh Bailey", - author_email="dbailey@hp.com", - maintainer="Davide Guerri", - maintainer_email="davide.guerri@hp.com", - description="Tool supporting import from upstream.", - license="Apache Software License", - keywords="git upstream workflow", - url="", - scripts=['git-upstream', os.path.join(os.path.dirname(__file__), - 'git_upstream', 'scripts', - 'rebase-editor.py')], - packages=find_packages(exclude=['test']), - install_requires=['GitPython>=0.3.2.RC1'], - extras_require = { - 'autocomplete': ['argcomplete'] - }, - long_description=read('README'), - cmdclass={'create_manpage': CreateManpage}, - classifiers=[ - "Development Status :: 4 - Beta", - "Topic :: Utilities", - "License :: OSI Approved :: Apache Software License" - ] -) - -try: - import argcomplete - print('Make sure to copy bash_completion/git-upstream in appropriate ' + - 'location (e.g. ~/.bash_completion)') -except ImportError: - print('Warning: argcomplete package is not installed, autocomplete will' + - ' not work.') +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..c483483 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,9 @@ +hacking>=0.5.6,<0.8 + +Sphinx>=1.1.2,<1.2 +discover +fixtures>=0.3.14 +python-subunit +testrepository>=0.0.17 +testtools>=0.9.32 +sphinxcontrib-programoutput diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..08aab87 --- /dev/null +++ b/tox.ini @@ -0,0 +1,31 @@ +[tox] +minversion = 1.6 +skipsdist = True +envlist = pep8, py27 + +[testenv] +usedevelop = True +install_command = pip install {opts} {packages} +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = + python setup.py testr --slowest --testr-args='{posargs}' + +[testenv:pep8] +commands = flake8 + +[testenv:cover] +commands = + python setup.py testr --coverage + +[testenv:doc] +commands = python setup.py create_manpage + +[testenv:venv] +commands = {posargs} + +[flake8] +# E125 and H are intentionally ignored +ignore = E125,H +show-source = True +exclude = .venv,.tox,dist,doc,build,*.egg