[Python-modules-commits] [sphinx-celery] 01/08: Adds bumpversion
Christopher Stuart Hoskin
mans0954 at moszumanska.debian.org
Fri Aug 18 07:00:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
mans0954 pushed a commit to tag v1.3.1
in repository sphinx-celery.
commit 60da5509afb7bae5b1878b6dd027be0cdf68e2c5
Author: Ask Solem <ask at celeryproject.org>
Date: Fri Jul 1 14:03:12 2016 -0700
Adds bumpversion
---
.bumpversion.cfg | 12 ++++
Makefile | 136 +++++++++++++++++++++++++++++++++++++++++-----
requirements/pkgutils.txt | 1 +
setup.py | 28 ++--------
sphinx_celery/__init__.py | 22 +++++---
5 files changed, 154 insertions(+), 45 deletions(-)
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
new file mode 100644
index 0000000..8ed30da
--- /dev/null
+++ b/.bumpversion.cfg
@@ -0,0 +1,12 @@
+[bumpversion]
+current_version = 1.3.0
+commit = True
+tag = True
+parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<releaselevel>[a-z]+)?
+serialize =
+ {major}.{minor}.{patch}{releaselevel}
+ {major}.{minor}.{patch}
+
+[bumpversion:file:sphinx_celery/__init__.py]
+
+[bumpversion:file:README.rst]
diff --git a/Makefile b/Makefile
index c766c30..f4ab55c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,37 +1,145 @@
PROJ=sphinx_celery
+PGPIDENT="Celery Security Team"
PYTHON=python
+GIT=git
+TOX=tox
+NOSETESTS=nosetests
+ICONV=iconv
+FLAKE8=flake8
+FLAKEPLUS=flakeplus
+SPHINX2RST=sphinx2rst
+
+SPHINX_DIR=docs/
+SPHINX_BUILDDIR="${SPHINX_DIR}/_build"
+README=README.rst
+README_SRC="docs/templates/readme.txt"
+CONTRIBUTING=CONTRIBUTING.rst
+CONTRIBUTING_SRC="docs/contributing.rst"
+SPHINX_HTMLDIR="${SPHINX_BUILDDIR}/html"
+DOCUMENTATION=Documentation
+FLAKEPLUSTARGET=2.7
+
+all: help
+
+help:
+ @echo "docs - Build documentation."
+ @echo "test-all - Run tests for all supported python versions."
+ @echo "distcheck ---------- - Check distribution for problems."
+ @echo " test - Run unittests using current python."
+ @echo " lint ------------ - Check codebase for problems."
+ @echo " apicheck - Check API reference coverage."
+ @echo " configcheck - Check configuration reference coverage."
+ @echo " readmecheck - Check README.rst encoding."
+ @echo " contribcheck - Check CONTRIBUTING.rst encoding"
+ @echo " flakes -------- - Check code for syntax and style errors."
+ @echo " flakecheck - Run flake8 on the source code."
+ @echo " flakepluscheck - Run flakeplus on the source code."
+ @echo "readme - Regenerate README.rst file."
+ @echo "contrib - Regenerate CONTRIBUTING.rst file"
+ @echo "clean-dist --------- - Clean all distribution build artifacts."
+ @echo " clean-git-force - Remove all uncomitted files."
+ @echo " clean ------------ - Non-destructive clean"
+ @echo " clean-pyc - Remove .pyc/__pycache__ files"
+ @echo " clean-docs - Remove documentation build artifacts."
+ @echo " clean-build - Remove setup artifacts."
+ @echo "bump - Bump patch version number."
+ @echo "bump-minor - Bump minor version number."
+ @echo "bump-major - Bump major version number."
+ @echo "release - Make PyPI release."
+
+clean: clean-docs clean-pyc clean-build
+
+clean-dist: clean clean-git-force
+
+bump:
+ bumpversion patch
+
+bump-minor:
+ bumpversion minor
+
+bump-major:
+ bumpversion major
+
+release:
+ python setup.py register sdist bdist_wheel upload --sign --identity="$(PGPIDENT)"
+
+Documentation:
+ (cd "$(SPHINX_DIR)"; $(MAKE) html)
+ mv "$(SPHINX_HTMLDIR)" $(DOCUMENTATION)
+
+docs: Documentation
+
+clean-docs:
+ -rm -rf "$(SPHINX_BUILDDIR)"
+
+lint: flakecheck apicheck configcheck readmecheck
+
+apicheck:
+ (cd "$(SPHINX_DIR)"; $(MAKE) apicheck)
+
+configcheck:
+ (cd "$(SPHINX_DIR)"; $(MAKE) configcheck)
flakecheck:
- # the only way to enable all errors is to ignore something bogus
- flake8 --ignore=X999 "$(PROJ)"
+ $(FLAKE8) "$(PROJ)"
flakediag:
-$(MAKE) flakecheck
flakepluscheck:
- flakeplus --2.7 "$(PROJ)"
+ $(FLAKEPLUS) --$(FLAKEPLUSTARGET) "$(PROJ)"
flakeplusdiag:
-$(MAKE) flakepluscheck
flakes: flakediag flakeplusdiag
-test:
- nosetests -x
+clean-readme:
+ -rm -f $(README)
-cov:
- nosetests -x --with-coverage --cover-html --cover-branch
+readmecheck:
+ $(ICONV) -f ascii -t ascii $(README) >/dev/null
+
+$(README):
+ $(SPHINX2RST) "$(README_SRC)" --ascii > $@
+
+readme: clean-readme $(README) readmecheck
-removepyc:
+clean-contrib:
+ -rm -f "$(CONTRIBUTING)"
+
+$(CONTRIBUTING):
+ $(SPHINX2RST) "$(CONTRIBUTING_SRC)" > $@
+
+contrib: clean-contrib $(CONTRIBUTING)
+
+clean-pyc:
-find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs rm
-find . -type d -name "__pycache__" | xargs rm -r
-gitclean: removepyc
- git clean -xdn
+removepyc: clean-pyc
+
+clean-build:
+ rm -rf build/ dist/ .eggs/ *.egg-info/ .tox/ .coverage cover/
+
+clean-git:
+ $(GIT) clean -xdn
+
+clean-git-force:
+ $(GIT) clean -xdf
+
+test-all: clean-pyc
+ $(TOX)
+
+test:
+ $(PYTHON) setup.py test
+
+cov:
+ $(NOSETESTS) -xv --with-coverage --cover-html --cover-branch
-gitcleanforce:
- git clean -xdf
+build:
+ $(PYTHON) setup.py sdist bdist_wheel
-distcheck: flakecheck test gitclean
+distcheck: lint test clean
-dist: gitcleanforce removepyc
+dist: readme contrib clean-dist build
diff --git a/requirements/pkgutils.txt b/requirements/pkgutils.txt
index ff0c55b..22da73b 100644
--- a/requirements/pkgutils.txt
+++ b/requirements/pkgutils.txt
@@ -3,3 +3,4 @@ wheel>=0.29.0
flake8>=2.5.4
flakeplus>=1.1
tox>=2.3.1
+bumpversion
diff --git a/setup.py b/setup.py
index e306edd..8c9efc7 100644
--- a/setup.py
+++ b/setup.py
@@ -1,15 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-try:
- from setuptools import setup, find_packages
- from setuptools.command.test import test
-except ImportError:
- raise
- from ez_setup import use_setuptools
- use_setuptools()
- from setuptools import setup, find_packages # noqa
- from setuptools.command.test import test # noqa
+from setuptools import setup, find_packages
import os
import re
@@ -40,30 +32,18 @@ classifiers = [s.strip() for s in classes.split('\n') if s]
# -*- Distribution Meta -*-
re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
-re_vers = re.compile(r'VERSION\s*=.*?\((.*?)\)')
re_doc = re.compile(r'^"""(.+?)"""')
-def rq(s):
- return s.strip("\"'")
-
-
def add_default(m):
attr_name, attr_value = m.groups()
- return ((attr_name, rq(attr_value)),)
-
-
-def add_version(m):
- v = list(map(rq, m.groups()[0].split(', ')))
- return (('VERSION', '.'.join(v[0:3]) + ''.join(v[3:])),)
+ return ((attr_name, attr_value.strip("\"'")),)
def add_doc(m):
return (('doc', m.groups()[0]),)
-pats = {re_meta: add_default,
- re_vers: add_version,
- re_doc: add_doc}
+pats = {re_meta: add_default, re_doc: add_doc}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'sphinx_celery', '__init__.py')) as meta_fh:
meta = {}
@@ -118,7 +98,7 @@ else:
setup(
name=NAME,
- version=meta['VERSION'],
+ version=meta['version'],
description=meta['doc'],
author=meta['author'],
author_email=meta['contact'],
diff --git a/sphinx_celery/__init__.py b/sphinx_celery/__init__.py
index 59a0b07..900b079 100644
--- a/sphinx_celery/__init__.py
+++ b/sphinx_celery/__init__.py
@@ -2,16 +2,11 @@
from __future__ import absolute_import, unicode_literals
import os
+import re
from collections import namedtuple
-version_info_t = namedtuple(
- 'version_info_t', ('major', 'minor', 'micro', 'releaselevel', 'serial'),
-)
-
-VERSION = version_info = version_info_t(1, 3, 0, '', '')
-
-__version__ = '{0.major}.{0.minor}.{0.micro}{0.releaselevel}'.format(VERSION)
+__version__ = '1.3.0'
__author__ = 'Ask Solem'
__contact__ = 'ask at celeryproject.org'
__homepage__ = 'http://github.com/celery/sphinx_celery'
@@ -21,6 +16,19 @@ __docformat__ = 'restructuredtext'
__all__ = ['get_html_templates_path', 'get_html_theme_path']
+version_info_t = namedtuple(
+ 'version_info_t', ('major', 'minor', 'micro', 'releaselevel', 'serial'),
+)
+
+# bumpversion can only search for {current_version}
+# so we have to parse the version here.
+_temp = re.match(
+ r'(\d+)\.(\d+).(\d+)(.+)?', __version__).groups()
+VERSION = version_info = version_info_t(
+ int(_temp[0]), int(_temp[1]), int(_temp[2]), _temp[3] or '', '')
+del(_temp)
+del(re)
+
def get_html_theme_path():
return os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sphinx-celery.git
More information about the Python-modules-commits
mailing list