From 154f30ec5a19d0a19de7f5e5178858e43479790b Mon Sep 17 00:00:00 2001 From: JinWang An Date: Mon, 28 Dec 2020 13:46:13 +0900 Subject: [PATCH] Imported Upstream version 4.2.0 --- .stestr.conf | 3 ++ .testr.conf | 4 -- ChangeLog | 10 ++++ PKG-INFO | 4 +- RELEASENOTES.rst | 52 ------------------ doc/requirements.txt | 3 ++ doc/source/user/features.rst | 37 +++++++++++++ doc/source/user/packagers.rst | 83 +++++++++++++++-------------- doc/source/user/using.rst | 88 ++++++++++++++++++++++++++++--- lower-constraints.txt | 2 +- pbr.egg-info/PKG-INFO | 4 +- pbr.egg-info/SOURCES.txt | 4 +- pbr/builddoc.py | 20 +++++++ pbr/packaging.py | 6 +++ pbr/sphinxext.py | 99 +++++++++++++++++++++++++++++++++++ releasenotes/notes/reno.cache | 55 ------------------- setup.cfg | 4 -- test-requirements.txt | 11 ++-- tox.ini | 20 +++---- 19 files changed, 323 insertions(+), 186 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf delete mode 100644 RELEASENOTES.rst create mode 100644 doc/requirements.txt create mode 100644 pbr/sphinxext.py delete mode 100644 releasenotes/notes/reno.cache diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..a2bf94e --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./pbr/tests +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index b3cfc54..0000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/ChangeLog b/ChangeLog index b7d6601..3641c3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,16 @@ CHANGES ======= +4.2.0 +----- + +* Deprecate 'test' integration +* Deprecate 'build\_sphinx' integration +* Add Sphinx extension +* doc: Add documentation for missing '[pbr]' options +* doc: Fix formatting of packagers guide +* Switch to stestr + 4.1.1 ----- diff --git a/PKG-INFO b/PKG-INFO index 6442a7f..9b34816 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,13 +1,13 @@ Metadata-Version: 2.1 Name: pbr -Version: 4.1.1 +Version: 4.2.0 Summary: Python Build Reasonableness Home-page: https://docs.openstack.org/pbr/latest/ Author: OpenStack Author-email: openstack-dev@lists.openstack.org License: UNKNOWN -Project-URL: Source Code, https://git.openstack.org/cgit/openstack-dev/pbr/ Project-URL: Bug Tracker, https://bugs.launchpad.net/pbr/ +Project-URL: Source Code, https://git.openstack.org/cgit/openstack-dev/pbr/ Project-URL: Documentation, https://docs.openstack.org/pbr/ Description: Introduction ============ diff --git a/RELEASENOTES.rst b/RELEASENOTES.rst deleted file mode 100644 index 95afa9c..0000000 --- a/RELEASENOTES.rst +++ /dev/null @@ -1,52 +0,0 @@ -=== -pbr -=== - -.. _pbr_4.0.0: - -4.0.0 -===== - -.. _pbr_4.0.0_New Features: - -New Features ------------- - -.. releasenotes/notes/v_version-457b38c8679c5868.yaml @ b'4c775e7890e90fc2ea77c66020659e52d6a61414' - -- Support version parsing of git tag with the ``v`` pattern - (or ``V``), in addition to ````. - - -.. _pbr_4.0.0_Upgrade Notes: - -Upgrade Notes -------------- - -.. releasenotes/notes/remove-command-hooks-907d9c2325f306ca.yaml @ b'32c90ba598d7740e52bf21bc5e920fb5df08645a' - -- Support for entry point command hooks has been removed. This feature was - poorly tested, poorly documented, and broken in some environments. - Support for global hooks is not affected. - - -.. _pbr_4.0.0_Deprecation Notes: - -Deprecation Notes ------------------ - -.. releasenotes/notes/deprecate-pyN-requirements-364655c38fa5b780.yaml @ b'9be181e8e60cc41f3ad685e236b0c4cdc29dbd3c' - -- Support for ``pyN``-suffixed requirement files has been deprecated: - environment markers should be used instead. - -.. releasenotes/notes/deprecate-testr-nose-integration-56e3e11248d946fc.yaml @ b'113685e1b94df9dd2945adbdda757a545b09598c' - -- *testr* and *nose* integration has been deprecated. This feature allowed - *pbr* to dynamically configure the test runner used when running - ``setup.py test``. However, this target has fallen out of favour in both - the OpenStack and broader Python ecosystem, and both *testr* and *nose* - offer native setuptools commands that can be manually aliased to ``test`` - on a per-project basis, if necessary. This feature will be removed in a - future release. - diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..b9c5e1f --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,3 @@ +sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD +openstackdocstheme>=1.18.1 # Apache-2.0 +reno>=2.5.0 # Apache-2.0 diff --git a/doc/source/user/features.rst b/doc/source/user/features.rst index 4ccac4f..dfbc18b 100644 --- a/doc/source/user/features.rst +++ b/doc/source/user/features.rst @@ -256,6 +256,8 @@ __ https://packaging.python.org/tutorials/distributing-packages/#manifest-in Setup Commands -------------- +.. _build_sphinx: + ``build_sphinx`` ~~~~~~~~~~~~~~~~ @@ -265,6 +267,15 @@ Setup Commands *pbr*-provided package metadata and automatically generate API documentation. +.. deprecated:: 4.2 + + This feature has been superseded by the `sphinxcontrib-apidoc`__ (for + generation of API documentation) and :ref:`pbr.sphinxext` (for configuration + of versioning via package metadata) extensions. It will be removed in a + future release. + + __ https://pypi.org/project/sphinxcontrib-apidoc/ + Sphinx can produce auto documentation indexes based on signatures and docstrings of your project but you have to give it index files to tell it to *autodoc* each module: that's kind of repetitive and boring. *pbr* will scan @@ -310,3 +321,29 @@ or `nose`__ (deprecated). __ https://testrepository.readthedocs.io/en/latest/ __ https://nose.readthedocs.io/en/latest/ __ https://setuptools.readthedocs.io/en/latest/setuptools.html#test-build-package-and-run-a-unittest-suite + +.. _pbr.sphinxext: + +Sphinx Extension +---------------- + +.. admonition:: Summary + + *pbr* provides a Sphinx extension to allow you to use *pbr* version + metadata in your Sphinx documentation. + +.. versionadded:: 4.2 + +*pbr* provides a Sphinx extension which can be used to configure version +numbers for documentation. The package does not need to be installed for this +to function. + +.. note:: + + The ``openstackdocstheme`` Sphinx theme provides similar functionality. + This should be preferred for official OpenStack projects. Refer to the + `documentation`__ for more information. + + __ https://docs.openstack.org/openstackdocstheme/ + +For more information on the extension, refer to :doc:`/user/using`. diff --git a/doc/source/user/packagers.rst b/doc/source/user/packagers.rst index a8faa31..74af8ac 100644 --- a/doc/source/user/packagers.rst +++ b/doc/source/user/packagers.rst @@ -2,21 +2,21 @@ Notes for Package maintainers =============================== -If you are maintaining packages of software that uses `pbr`, there are some +If you are maintaining packages of software that uses *pbr*, there are some features you probably want to be aware of that can make your life easier. They are exposed by environment variables, so adding them to rules or spec files should be fairly easy. Versioning -========== +---------- -`pbr`, when run in a git repo, derives the version of a package from the +*pbr*, when run in a git repo, derives the version of a package from the git tags. When run in a tarball with a proper egg-info dir, it will happily pull the version from that. So for the most part, the package maintainers shouldn't need to care. However, if you are doing something like keeping a git repo with the sources and the packaging intermixed and it's causing pbr to get confused about whether its in its own git repo or not, you can set -`PBR_VERSION`: +``PBR_VERSION``: :: @@ -26,73 +26,80 @@ and all version calculation logic will be completely skipped and the supplied version will be considered absolute. Distribution version numbers -============================ - -`pbr` will automatically calculate upstream version numbers for dpkg and rpm -using systems. Releases are easy (and obvious). When packaging preleases though -things get more complex. Firstly, semver does not provide for any sort order -between pre-releases and development snapshots, so it can be complex (perhaps -intractable) to package both into one repository - we recommend with either -packaging pre-release releases (alpha/beta/rc's) or dev snapshots but not both. -Secondly, as pre-releases and snapshots have the same major/minor/patch version -as the version they lead up to, but have to sort before it, we cannot map their -version naturally into the rpm version namespace: instead we represent their -versions as versions of the release before. +---------------------------- + +*pbr* will automatically calculate upstream version numbers for *dpkg* and +*rpm* using systems. Releases are easy (and obvious). When packaging +pre-releases though things get more complex. Firstly, semver does not provide +for any sort order between pre-releases and development snapshots, so it can be +complex (perhaps intractable) to package both into one repository - we +recommend with either packaging pre-release releases (alpha/beta/rc's) or dev +snapshots but not both. Secondly, as pre-releases and snapshots have the same +major/minor/patch version as the version they lead up to, but have to sort +before it, we cannot map their version naturally into the rpm version +namespace: instead we represent their versions as versions of the release +before. Dependencies -============ +------------ -As of 1.0.0 `pbr` doesn't alter the dependency behaviour of `setuptools`. +As of 1.0.0 *pbr* doesn't alter the dependency behaviour of *setuptools*. -Older versions would invoke `pip` internally under some circumstances and -required the environment variable `SKIP_PIP_INSTALL` to be set to prevent +Older versions would invoke *pip* internally under some circumstances and +required the environment variable ``SKIP_PIP_INSTALL`` to be set to prevent that. Since 1.0.0 we now document that dependencies should be installed before -installing a `pbr` using package. We don't support easy install, but neither +installing a *pbr* using package. We don't support easy install, but neither do we interfere with it today. If you observe easy install being triggered when building a binary package, then you've probably missed one or more package requirements. -Note: we reserve the right to disable easy install via `pbr` in future, since -we don't want to debug or support the interactions that can occur when using -it. +.. important:: + + We reserve the right to disable easy install via *pbr* in future, since we + don't want to debug or support the interactions that can occur when using + it. + +.. _packaging-tarballs: Tarballs -======== +-------- -`pbr` includes everything in a source tarball that is in the original `git` +*pbr* includes everything in a source tarball that is in the original *git* repository. This can again cause havoc if a package maintainer is doing fancy -things with combined `git` repos, and is generating a source tarball using -`python setup.py sdist` from that repo. If that is the workflow the packager -is using, setting `SKIP_GIT_SDIST`: +things with combined *git* repos, and is generating a source tarball using +``python setup.py sdist`` from that repo. If that is the workflow the packager +is using, setting ``SKIP_GIT_SDIST``: :: export SKIP_GIT_SDIST=1 will cause all logic around using git to find the files that should be in the -source tarball to be skipped. Beware though, that because `pbr` packages +source tarball to be skipped. Beware though, that because *pbr* packages automatically find all of the files, most of them do not have a complete -`MANIFEST.in` file, so its possible that a tarball produced in that way will +``MANIFEST.in`` file, so its possible that a tarball produced in that way will be missing files. +.. _packaging-authors-changelog: + AUTHORS and ChangeLog -===================== +--------------------- -`pbr` generates AUTHORS and ChangeLog files from git information. This -can cause problem in distro packaging if package maintainer is using git +*pbr* generates ``AUTHORS`` and ``ChangeLog`` files from *git* information. +This can cause problem in distro packaging if package maintainer is using *git* repository for packaging source. If that is the case setting -`SKIP_GENERATE_AUTHORS` +``SKIP_GENERATE_AUTHORS`` :: export SKIP_GENERATE_AUTHORS=1 -will cause logic around generating AUTHORS using git information to be -skipped. Similarly setting `SKIP_WRITE_GIT_CHANGELOG` +will cause logic around generating ``AUTHORS`` using *git* information to be +skipped. Similarly setting ``SKIP_WRITE_GIT_CHANGELOG`` :: export SKIP_WRITE_GIT_CHANGELOG=1 -will cause logic around generating ChangeLog file using git +will cause logic around generating ``ChangeLog`` file using *git* information to be skipped. diff --git a/doc/source/user/using.rst b/doc/source/user/using.rst index f8da6de..b5e28eb 100644 --- a/doc/source/user/using.rst +++ b/doc/source/user/using.rst @@ -209,39 +209,80 @@ the ``Fancy`` class in ``pbr.cfg.driver``. The ``pbr`` section controls *pbr*-specific options and behaviours. -``autodoc_tree_index_modules`` +``skip_git_sdist`` + If enabled, *pbr* will not generate a manifest file from *git* commits. If + this is enabled, you may need to define your own `manifest template`__. + + This can also be configured using the ``SKIP_GIT_SDIST`` environment + variable, as described :ref:`here `. + + __ https://packaging.python.org/tutorials/distributing-packages/#manifest-in + +``skip_changelog`` + If enabled, *pbr* will not generated a ``ChangeLog`` file from *git* commits. + This can also be configured using the ``SKIP_WRITE_GIT_CHANGELOG`` + environment variable, as described :ref:`here ` + +``skip_authors`` + If enabled, *pbr* will not generate an ``AUTHORS`` file from *git* commits. + + This can also be configured using the ``SKIP_GENERATE_AUTHORS`` environment + variable, as described :ref:`here ` + +``autodoc_tree_index_modules`` A boolean option controlling whether *pbr* should generate an index of modules using ``sphinx-apidoc``. By default, all files except ``setup.py`` are included, but this can be overridden using the ``autodoc_tree_excludes`` option. -``autodoc_tree_excludes`` + .. deprecated:: 4.2 + + This feature has been replaced by the `sphinxcontrib-apidoc`_ extension. + Refer to the :ref:`build_sphinx` overview for more information. +``autodoc_tree_excludes`` A list of modules to exclude when building documentation using ``sphinx-apidoc``. Defaults to ``[setup.py]``. Refer to the `sphinx-apidoc man page`__ for more information. -__ http://sphinx-doc.org/man/sphinx-apidoc.html + __ http://sphinx-doc.org/man/sphinx-apidoc.html -``autodoc_index_modules`` + .. deprecated:: 4.2 + This feature has been replaced by the `sphinxcontrib-apidoc`_ extension. + Refer to the :ref:`build_sphinx` overview for more information. + +``autodoc_index_modules`` A boolean option controlling whether *pbr* should itself generates documentation for Python modules of the project. By default, all found Python modules are included; some of them can be excluded by listing them in ``autodoc_exclude_modules``. -``autodoc_exclude_modules`` + .. deprecated:: 4.2 + + This feature has been replaced by the `sphinxcontrib-apidoc`_ extension. + Refer to the :ref:`build_sphinx` overview for more information. +``autodoc_exclude_modules`` A list of modules to exclude when building module documentation using *pbr*. *fnmatch* style pattern (e.g. ``myapp.tests.*``) can be used. -``api_doc_dir`` + .. deprecated:: 4.2 + This feature has been replaced by the `sphinxcontrib-apidoc`_ extension. + Refer to the :ref:`build_sphinx` overview for more information. + +``api_doc_dir`` A subdirectory inside the ``build_sphinx.source_dir`` where auto-generated API documentation should be written, if ``autodoc_index_modules`` is set to True. Defaults to ``"api"``. + .. deprecated:: 4.2 + + This feature has been replaced by the `sphinxcontrib-apidoc`_ extension. + Refer to the :ref:`build_sphinx` overview for more information. + .. note:: When using ``autodoc_tree_excludes`` or ``autodoc_index_modules`` you may @@ -252,7 +293,13 @@ __ http://sphinx-doc.org/man/sphinx-apidoc.html set. See the `Sphinx build configuration file`__ documentation for more information on configuring Sphinx. -__ http://sphinx-doc.org/config.html + __ http://sphinx-doc.org/config.html + +.. versionchanged:: 4.2 + + The ``autodoc_tree_index_modules``, ``autodoc_tree_excludes``, + ``autodoc_index_modules``, ``autodoc_exclude_modules`` and ``api_doc_dir`` + settings are all deprecated. .. versionchanged:: 2.0 @@ -277,6 +324,13 @@ __ http://sphinx-doc.org/config.html page output. This is no longer the case, and you should explicitly set ``builders`` to ``html man`` if you wish to retain this behavior. +.. deprecated:: 4.2 + + This feature has been superseded by the `sphinxcontrib-apidoc`_ (for + generation of API documentation) and :ref:`pbr.sphinxext` (for configuration + of versioning via package metadata) extensions. It will be removed in a + future release. + The ``build_sphinx`` section is a version of the ``build_sphinx`` *setuptools* plugin provided with Sphinx. This plugin extends the original plugin to add the following: @@ -414,4 +468,24 @@ The argument ``--coverage`` will set ``PYTHON`` to ``coverage run`` to produce a coverage report. ``--coverage-package-name`` can be used to modify or narrow the packages traced. + +Sphinx ``conf.py`` +------------------ + +As described in :doc:`/user/features`, *pbr* provides a Sphinx extension to +automatically configure the version numbers for your documentation using *pbr* +metadata. + +To enable this extension, you must add it to the list of extensions in +your ``conf.py`` file:: + + extensions = [ + 'pbr.sphinxext', + # ... other extensions + ] + +You should also unset/remove the ``version`` and ``release`` attributes from +this file. + .. _setuptools: http://www.sphinx-doc.org/en/stable/setuptools.html +.. _sphinxcontrib-apidoc: https://pypi.org/project/sphinxcontrib-apidoc/ diff --git a/lower-constraints.txt b/lower-constraints.txt index fefbe45..44956ce 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -1,6 +1,5 @@ alabaster==0.7.10 Babel==2.3.4 -coverage==4.0 docutils==0.11 dulwich==0.15.0 extras==1.0.0 @@ -27,6 +26,7 @@ six==1.10.0 snowballstemmer==1.2.1 Sphinx==1.6.5 sphinxcontrib-websupport==1.0.1 +stestr==2.0.0 testrepository==0.0.18 testresources==2.0.0 testscenarios==0.4 diff --git a/pbr.egg-info/PKG-INFO b/pbr.egg-info/PKG-INFO index 6442a7f..9b34816 100644 --- a/pbr.egg-info/PKG-INFO +++ b/pbr.egg-info/PKG-INFO @@ -1,13 +1,13 @@ Metadata-Version: 2.1 Name: pbr -Version: 4.1.1 +Version: 4.2.0 Summary: Python Build Reasonableness Home-page: https://docs.openstack.org/pbr/latest/ Author: OpenStack Author-email: openstack-dev@lists.openstack.org License: UNKNOWN -Project-URL: Source Code, https://git.openstack.org/cgit/openstack-dev/pbr/ Project-URL: Bug Tracker, https://bugs.launchpad.net/pbr/ +Project-URL: Source Code, https://git.openstack.org/cgit/openstack-dev/pbr/ Project-URL: Documentation, https://docs.openstack.org/pbr/ Description: Introduction ============ diff --git a/pbr.egg-info/SOURCES.txt b/pbr.egg-info/SOURCES.txt index 619cf06..88cc210 100644 --- a/pbr.egg-info/SOURCES.txt +++ b/pbr.egg-info/SOURCES.txt @@ -1,6 +1,6 @@ .coveragerc .mailmap -.testr.conf +.stestr.conf .zuul.yaml AUTHORS CONTRIBUTING.rst @@ -12,6 +12,7 @@ setup.cfg setup.py test-requirements.txt tox.ini +doc/requirements.txt doc/source/conf.py doc/source/index.rst doc/source/contributor/index.rst @@ -32,6 +33,7 @@ pbr/git.py pbr/options.py pbr/packaging.py pbr/pbr_json.py +pbr/sphinxext.py pbr/testr_command.py pbr/util.py pbr/version.py diff --git a/pbr/builddoc.py b/pbr/builddoc.py index 4d291fb..f5c66ce 100644 --- a/pbr/builddoc.py +++ b/pbr/builddoc.py @@ -57,6 +57,9 @@ from pbr import options from pbr import version +_deprecated_options = ['autodoc_tree_index_modules', 'autodoc_index_modules', + 'autodoc_tree_excludes', 'autodoc_exclude_modules'] +_deprecated_envs = ['AUTODOC_TREE_INDEX_MODULES', 'AUTODOC_INDEX_MODULES'] _rst_template = """%(heading)s %(underline)s @@ -181,6 +184,23 @@ class LocalBuildDoc(setup_command.BuildDoc): def run(self): option_dict = self.distribution.get_option_dict('pbr') + + # TODO(stephenfin): Remove this (and the entire file) when 5.0 is + # released + warn_opts = set(option_dict.keys()).intersection(_deprecated_options) + warn_env = list(filter(lambda x: os.getenv(x), _deprecated_envs)) + if warn_opts or warn_env: + msg = ('The autodoc and autodoc_tree features are deprecated in ' + '4.2 and will be removed in a future release. You should ' + 'use the sphinxcontrib-apidoc Sphinx extension instead. ' + 'Refer to the pbr documentation for more information.') + if warn_opts: + msg += ' Deprecated options: %s' % list(warn_opts) + if warn_env: + msg += ' Deprecated environment variables: %s' % warn_env + + log.warn(msg) + if git._git_is_installed(): git.write_git_changelog(option_dict=option_dict) git.generate_authors(option_dict=option_dict) diff --git a/pbr/packaging.py b/pbr/packaging.py index 44bfb1a..8656a6c 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -217,8 +217,14 @@ class TestrTest(testr_command.Testr): """Make setup.py test do the right thing.""" command_name = 'test' + description = 'DEPRECATED: Run unit tests using testr' def run(self): + warnings.warn('testr integration is deprecated in pbr 4.2 and will ' + 'be removed in a future release. Please call your test ' + 'runner directly', + DeprecationWarning) + # Can't use super - base class old-style class testr_command.Testr.run(self) diff --git a/pbr/sphinxext.py b/pbr/sphinxext.py new file mode 100644 index 0000000..ef61305 --- /dev/null +++ b/pbr/sphinxext.py @@ -0,0 +1,99 @@ +# Copyright 2018 Red Hat, Inc. +# All Rights Reserved. +# +# 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. + +import os.path + +from six.moves import configparser +from sphinx.util import logging + +import pbr.version + +_project = None +logger = logging.getLogger(__name__) + + +def _find_setup_cfg(srcdir): + """Find the 'setup.cfg' file, if it exists. + + This assumes we're using 'doc/source' for documentation, but also allows + for single level 'doc' paths. + """ + # TODO(stephenfin): Are we sure that this will always exist, e.g. for + # an sdist or wheel? Perhaps we should check for 'PKG-INFO' or + # 'METADATA' files, a la 'pbr.packaging._get_version_from_pkg_metadata' + for path in [ + os.path.join(srcdir, os.pardir, 'setup.cfg'), + os.path.join(srcdir, os.pardir, os.pardir, 'setup.cfg')]: + if os.path.exists(path): + return path + + return None + + +def _get_project_name(srcdir): + """Return string name of project name, or None. + + This extracts metadata from 'setup.cfg'. We don't rely on + distutils/setuptools as we don't want to actually install the package + simply to build docs. + """ + global _project + + if _project is None: + parser = configparser.ConfigParser() + + path = _find_setup_cfg(srcdir) + if not path or not parser.read(path): + logger.info('Could not find a setup.cfg to extract project name ' + 'from') + return None + + try: + # for project name we use the name in setup.cfg, but if the + # length is longer then 32 we use summary. Otherwise thAe + # menu rendering looks brolen + project = parser.get('metadata', 'name') + if len(project.split()) == 1 and len(project) > 32: + project = parser.get('metadata', 'summary') + except configparser.Error: + logger.info('Could not extract project metadata from setup.cfg') + return None + + _project = project + + return _project + + +def _builder_inited(app): + # TODO(stephenfin): Once Sphinx 1.8 is released, we should move the below + # to a 'config-inited' handler + + project_name = _get_project_name(app.srcdir) + try: + version_info = pbr.version.VersionInfo(project_name) + except Exception: + version_info = None + + if version_info and not app.config.version and not app.config.release: + app.config.version = version_info.canonical_version_string() + app.config.release = version_info.version_string_with_vcs() + + +def setup(app): + app.connect('builder-inited', _builder_inited) + return { + 'parallel_read_safe': True, + 'parallel_write_safe': True, + } diff --git a/releasenotes/notes/reno.cache b/releasenotes/notes/reno.cache deleted file mode 100644 index 05b51f5..0000000 --- a/releasenotes/notes/reno.cache +++ /dev/null @@ -1,55 +0,0 @@ ---- -file-contents: - releasenotes/notes/deprecate-pyN-requirements-364655c38fa5b780.yaml: - deprecations: ['Support for ``pyN``-suffixed requirement files has been deprecated: - - environment markers should be used instead. - - '] - releasenotes/notes/deprecate-testr-nose-integration-56e3e11248d946fc.yaml: - deprecations: ['*testr* and *nose* integration has been deprecated. This feature - allowed - - *pbr* to dynamically configure the test runner used when running - - ``setup.py test``. However, this target has fallen out of favour in both - - the OpenStack and broader Python ecosystem, and both *testr* and *nose* - - offer native setuptools commands that can be manually aliased to ``test`` - - on a per-project basis, if necessary. This feature will be removed in a - - future release. - - '] - releasenotes/notes/remove-command-hooks-907d9c2325f306ca.yaml: - upgrade: ['Support for entry point command hooks has been removed. This feature - was - - poorly tested, poorly documented, and broken in some environments. - - Support for global hooks is not affected. - - '] - releasenotes/notes/v_version-457b38c8679c5868.yaml: - features: ['Support version parsing of git tag with the ``v`` pattern - - (or ``V``), in addition to ````. - - '] -notes: -- files: - - - releasenotes/notes/deprecate-pyN-requirements-364655c38fa5b780.yaml - - !!binary | - OWJlMTgxZThlNjBjYzQxZjNhZDY4NWUyMzZiMGM0Y2RjMjlkYmQzYw== - - - releasenotes/notes/deprecate-testr-nose-integration-56e3e11248d946fc.yaml - - !!binary | - MTEzNjg1ZTFiOTRkZjlkZDI5NDVhZGJkZGE3NTdhNTQ1YjA5NTk4Yw== - - - releasenotes/notes/remove-command-hooks-907d9c2325f306ca.yaml - - !!binary | - MzJjOTBiYTU5OGQ3NzQwZTUyYmYyMWJjNWU5MjBmYjVkZjA4NjQ1YQ== - - - releasenotes/notes/v_version-457b38c8679c5868.yaml - - !!binary | - NGM3NzVlNzg5MGU5MGZjMmVhNzdjNjYwMjA2NTllNTJkNmE2MTQxNA== - version: 4.0.0 diff --git a/setup.cfg b/setup.cfg index 2e153ea..8d6451c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,10 +32,6 @@ classifier = packages = pbr -[global] -setup-hooks = - pbr.hooks.setup_hook - [pbr] autodoc_tree_index_modules = True autodoc_tree_excludes = diff --git a/test-requirements.txt b/test-requirements.txt index de91490..8fdcb83 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,17 +1,16 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 mock>=2.0.0 # BSD -python-subunit>=1.0.0 # Apache-2.0/BSD -sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD -openstackdocstheme>=1.18.1 # Apache-2.0 -reno>=2.5.0 # Apache-2.0 six>=1.10.0 # MIT -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=2.0.0 # Apache-2.0 testresources>=2.0.0 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT virtualenv>=14.0.6 # MIT + +# optionally exposed by distutils commands +sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD +testrepository>=0.0.18 # Apache-2.0/BSD diff --git a/tox.ini b/tox.ini index 4341007..cf27d98 100644 --- a/tox.ini +++ b/tox.ini @@ -1,19 +1,15 @@ [tox] minversion = 2.0 -envlist = py35,py36,py27,pypy,pep8,docs +envlist = py{27,35,36},pep8,docs [testenv] usedevelop = True install_command = pip install {opts} {packages} passenv = PBR_INTEGRATION PIPFLAGS PIPVERSION PBRVERSION REPODIR WHEELHOUSE PROJECTS OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} - -r{toxinidir}/test-requirements.txt -commands = - python setup.py test --testr-args='{posargs}' - -[tox:jenkins] -sitepackages = True + -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} + -r{toxinidir}/test-requirements.txt +commands = stestr run {posargs} [testenv:pep8] basepython = python3 @@ -21,19 +17,16 @@ commands = flake8 {posargs} [testenv:docs] basepython = python3 +deps = -r{toxinidir}/doc/requirements.txt commands = python setup.py build_sphinx [testenv:releasenotes] basepython = python3 +deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf releasenotes/build sphinx-build -W -b html -d releasenotes/build/doctrees releasenotes/source releasenotes/build/html -[testenv:cover] -basepython = python3 -commands = - python setup.py test --coverage - [testenv:venv] basepython = python3 commands = {posargs} @@ -51,4 +44,3 @@ basepython = python3 deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt - -- 2.34.1