summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2014-04-28 16:34:25 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2014-05-02 10:21:17 +0900
commit8e9ae8c819e9927b2a41678ec186eac2cf035ab6 (patch)
tree919e226c9be3df0166bfebeff6e60aaf2fa85020
parent0cd7518c21140d480e06a1d6086b6fe71e6d7533 (diff)
downloadpygerrit-8e9ae8c819e9927b2a41678ec186eac2cf035ab6.tar.gz
Migrate setup to pbr
pbr provides better version handling, and automates the release notes and list of authors. This means we have to spend less time manually updating things. Change-Id: Ie79d706ec7a177f437b6bb0e38a9bded8bc4bb9e
-rw-r--r--.gitignore4
-rw-r--r--.project17
-rw-r--r--.pydevproject10
-rw-r--r--AUTHORS.rst17
-rw-r--r--HISTORY.rst71
-rw-r--r--Makefile16
-rw-r--r--pygerrit/__init__.py3
-rw-r--r--requirements.txt1
-rw-r--r--setup.cfg21
-rwxr-xr-xsetup.py36
-rwxr-xr-xunittests.py23
-rwxr-xr-xversion.py33
12 files changed, 33 insertions, 219 deletions
diff --git a/.gitignore b/.gitignore
index abe3c39..7bb8fd6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,12 @@
*.pyc
+.project
+.pydevproject
.settings
build/
dist/
docs/
pygerrit.egg-info/
pygerritenv/
+ChangeLog
+AUTHORS
MANIFEST
diff --git a/.project b/.project
deleted file mode 100644
index e0660b1..0000000
--- a/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>pygerrit</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.python.pydev.PyDevBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.python.pydev.pythonNature</nature>
- </natures>
-</projectDescription>
diff --git a/.pydevproject b/.pydevproject
deleted file mode 100644
index c6276f6..0000000
--- a/.pydevproject
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?eclipse-pydev version="1.0"?>
-
-<pydev_project>
-<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
-<path>/pygerrit</path>
-</pydev_pathproperty>
-<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
-<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python</pydev_property>
-</pydev_project>
diff --git a/AUTHORS.rst b/AUTHORS.rst
deleted file mode 100644
index 0359886..0000000
--- a/AUTHORS.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-pygerrit is written and maintained by David Pursehouse and
-various contributors:
-
-Development Lead
-````````````````
-
-- David Pursehouse <david.pursehouse@sonymobile.com>
-
-
-Patches and Suggestions
-```````````````````````
-
-- Ernst Sjöstrand <ernst.sjostrand@sonymobile.com>
-- Jens Andersen <jens.andersen@gmail.com>
-- Christopher Zee <christopher.xs.zee@gmail.com>
-- Johannes Richter <johannes.richter@kernkonzept.com>
-- Andrey Devyatkin <andrey.a.devyatkin@gmail.com>
diff --git a/HISTORY.rst b/HISTORY.rst
deleted file mode 100644
index 04debc4..0000000
--- a/HISTORY.rst
+++ /dev/null
@@ -1,71 +0,0 @@
-.. :changelog:
-
-History
--------
-
-0.2.5 (2014-04-17)
-++++++++++++++++++
-- Update examples to use argparse instead of optparse
-- Fix hanging ssh connections when stream closes
-
-0.2.4 (2014-03-17)
-++++++++++++++++++
-
-- Accept kwargs for request functions
-- Add badges to the README
-- Fix README markup to work properly in Gitlab
-- Update link to Gerrit documentation
-
-0.2.3 (2013-12-17)
-++++++++++++++++++
-
-- Fix packaging to include REST subpackage
-
-0.2.2 (2013-11-15)
-++++++++++++++++++
-
-- Fix exception and handle errors in the REST API example script
-- Allow to get the SSH username from the client session
-- Allow to run a command from the client session
-- Add ``username`` field in the Account model
-- Simplify error handling in the REST API
-- Make sure ``sortkey`` always gets initialised in the Change model
-- Add ``status`` field in the Change model
-- Add ``current_patchset`` field in the Change model
-- Add ``approver`` field in the Approval model
-
-0.2.1 (2013-10-21)
-++++++++++++++++++
-
-- Minor documentation updates
-
-0.2.0 (2013-10-21)
-++++++++++++++++++
-
-- Add basic support for Gerrit's REST API
-- Fix crash in stream-events handling when events do not have ``reason`` field
-- Add ``sortKey`` to query results to allow resuming queries
-- Remove unused ``patchset`` member from ``change-abandoned`` and ``change-restored`` events
-- Fix busy loop when processing stream events
-- Ensure errors in JSON parsing don't leave everything in a broken state
-
-0.1.1 (2013-09-13)
-++++++++++++++++++
-
-- Support for Mac OSX
-- Make the connection setup thread-safe
-- Unknown event types are no longer treated as errors
-- Clients can access event data that is not encapsulated by the event classes
-- Better handling of errors when parsing json data in the event stream
-- SSH username and port can be manually specified instead of relying on ``~/.ssh/config``
-- Support for the ``merge-failed`` event
-- Support for the ``reviewer-added`` event
-- Support for the ``topic-changed`` event
-- Add ``--verbose`` (debug logging) option in the example script
-- Add ``--ignore-stream-errors`` option in the example script
-- Improved documentation
-
-0.1.0 (2013-08-02)
-++++++++++++++++++
-
-- First released version
diff --git a/Makefile b/Makefile
index b458e52..9d029f3 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,6 @@
PWD := $(shell pwd)
TAG := $(shell git tag -l --contains HEAD)
-STATUS := $(shell git status --porcelain)
VIRTUALENV := $(shell which virtualenv)
ifeq ($(wildcard $(VIRTUALENV)),)
@@ -44,7 +43,7 @@ test: clean unittests pyflakes pep8 pep257
docs: html
-sdist: valid-virtualenv test valid-env
+sdist: valid-virtualenv test
bash -c "\
source ./pygerritenv/bin/activate && \
python setup.py sdist"
@@ -55,22 +54,11 @@ ddist: sdist docs
zip -r $(PWD)/dist/pygerrit-$(TAG)-api-documentation.zip . && \
cd $(PWD)"
-valid-env: valid-version valid-git-status
-
valid-virtualenv:
ifeq ($(VIRTUALENV_OK),0)
$(error virtualenv version $(REQUIRED_VIRTUALENV) or higher is needed)
endif
-valid-version: valid-tag
- @python version.py $(TAG)
-
-valid-tag:
- @echo "$(TAG)" | grep -q "^[0-9]\+\.[0-9]\+\.[0-9]\+$$"
-
-valid-git-status:
- @echo "$(STATUS)" | grep -q "^$$"
-
html: sphinx
bash -c "\
source ./pygerritenv/bin/activate && \
@@ -127,7 +115,7 @@ envsetup: envinit
pip install --upgrade -r requirements.txt"
envinit:
- bash -c "[ -e ./pygerritenv/bin/activate ] || virtualenv ./pygerritenv"
+ bash -c "[ -e ./pygerritenv/bin/activate ] || virtualenv --system-site-packages ./pygerritenv"
clean:
@find . -type f -name "*.pyc" -exec rm -f {} \;
diff --git a/pygerrit/__init__.py b/pygerrit/__init__.py
index 43eba69..7424b74 100644
--- a/pygerrit/__init__.py
+++ b/pygerrit/__init__.py
@@ -22,9 +22,6 @@
""" Module to interface with Gerrit. """
-__numversion__ = (0, 2, 5)
-__version__ = '.'.join([str(num) for num in __numversion__])
-
def from_json(json_data, key):
""" Helper method to extract values from JSON data.
diff --git a/requirements.txt b/requirements.txt
index 3c655d8..750d171 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1,2 @@
+pbr==0.8.0
requests==2.0.1
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..e64e45f
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,21 @@
+[metadata]
+name = pygerrit
+summary = Client library for interacting with Gerrit
+author = David Pursehouse
+author_email = david.pursehouse@sonymobile.com
+home-page = https://github.com/sonyxperiadev/pygerrit
+license = The MIT License
+keywords =
+ gerrit
+ rest
+ http
+ json
+classifiers =
+ Development Status :: 3 - Alpha
+ Environment :: Console
+ Intended Audience :: Developers
+ License :: OSI Approved :: MIT License
+ Natural Language :: English
+ Programming Language :: Python
+ Programming Language :: Python :: 2.6
+ Programming Language :: Python :: 2.7
diff --git a/setup.py b/setup.py
index ea6b59f..97d4d57 100755
--- a/setup.py
+++ b/setup.py
@@ -25,40 +25,14 @@
""" Client library for interacting with Gerrit. """
-from setuptools import setup, find_packages
-
-from pygerrit import __version__
-
-REQUIRES = ['requests==2.0.1']
+import setuptools
def _main():
- setup(
- name="pygerrit",
- description="Client library for interacting with Gerrit",
- long_description=open('README.rst').read(),
- version=__version__,
- license=open('LICENSE').read(),
- author="David Pursehouse",
- author_email="david.pursehouse@sonymobile.com",
- maintainer="David Pursehouse",
- maintainer_email="david.pursehouse@sonymobile.com",
- url="https://github.com/sonyxperiadev/pygerrit",
- packages=find_packages(),
- keywords='gerrit, json, rest, http',
- install_requires=REQUIRES,
- classifiers=(
- 'Development Status :: 3 - Alpha',
- 'Environment :: Console',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: MIT License',
- 'Natural Language :: English',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 2.6',
- 'Programming Language :: Python :: 2.7',
- ),
- )
-
+ setuptools.setup(
+ packages=setuptools.find_packages(),
+ setup_requires=['pbr'],
+ pbr=True)
if __name__ == "__main__":
_main()
diff --git a/unittests.py b/unittests.py
index 5a074ea..f853e35 100755
--- a/unittests.py
+++ b/unittests.py
@@ -27,29 +27,6 @@
import unittest
-from setup import REQUIRES as setup_requires
-
-
-class TestConsistentDependencies(unittest.TestCase):
-
- """ Verify that dependency package versions are consistent. """
-
- def test_dependencies(self):
- requirements_txt = {}
- setup_py = {}
-
- for package in open("requirements.txt").read().strip().splitlines():
- name, version = package.split('==')
- requirements_txt[name] = version
-
- for package in setup_requires:
- name, version = package.split('==')
- setup_py[name] = version
-
- self.assertEquals(requirements_txt, setup_py,
- "Inconsistency between dependency package versions "
- "listed in requirements.txt and setup.py")
-
if __name__ == '__main__':
unittest.main()
diff --git a/version.py b/version.py
deleted file mode 100755
index d9e92cd..0000000
--- a/version.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# The MIT License
-#
-# Copyright 2013 Sony Mobile Communications. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-""" Helper script to check release version. """
-
-import sys
-
-from pygerrit import __version__
-
-if len(sys.argv) < 2 or sys.argv[1].strip() != __version__:
- sys.exit(1)