From 0bb7665f193ddfc48a24c0edafec644952445c4b Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 18 Jul 2022 10:15:43 +0900 Subject: [PATCH] Imported Upstream version 5.9.0 --- .pre-commit-config.yaml | 2 +- AUTHORS | 3 +++ ChangeLog | 10 ++++++++ PKG-INFO | 48 ++------------------------------------- doc/source/user/using.rst | 4 ++-- pbr.egg-info/PKG-INFO | 48 ++------------------------------------- pbr/version.py | 41 +++++++++++++++++++++++++++++---- pyproject.toml.future | 5 +++- setup.cfg | 17 +++++++------- tox.ini | 6 ++--- 10 files changed, 73 insertions(+), 111 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f6ad7b..319697b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: ebc15addedad713c86ef18ae9632c88e187dd0af # v3.1.0 + rev: 9136088a246768144165fcc3ecc3d31bb686920a # v3.3.0 hooks: - id: trailing-whitespace # Replaces or checks mixed line ending diff --git a/AUTHORS b/AUTHORS index c43d177..d771f1e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -60,6 +60,7 @@ Jason Kölker Jason R. Coombs Jay Pipes Jeremy Stanley +Jiri Podivin Joe D'Andrea Joe Gordon Joe Gordon @@ -150,6 +151,8 @@ melissaml nizam qingszhao weiweigu +wu.shiming xuanyandong +yangyawei zhangyangyang zhangyanxian diff --git a/ChangeLog b/ChangeLog index 0b05c75..b429d13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,20 @@ CHANGES ======= +5.9.0 +----- + +* Future-proofing pyproject.toml +* Use importlib-metadata for runtime package version lookups +* Drop wheel from pyproject.toml examples +* Changed minversion in tox to 3.18.0 + 5.8.1 ----- * Add release note about missing pbr.json fix * Avoid recursive calls into SetupTools entrypoint +* setup.cfg: Replace dashes with underscores * remove explicit mock * Don't test with setuptools local distutils * Use context blocks for open() calls in packaging @@ -24,6 +33,7 @@ CHANGES * PBR package testing improvements * Run python3.9 test jobs * Retire django-openstack-auth +* Upgrade the pre-commit-hooks version * Correct comment for 'D1\_D2\_SETUP\_ARGS' 5.6.0 diff --git a/PKG-INFO b/PKG-INFO index 5847662..ce4212c 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pbr -Version: 5.8.1 +Version: 5.9.0 Summary: Python Build Reasonableness Home-page: https://docs.openstack.org/pbr/latest/ Author: OpenStack @@ -9,51 +9,7 @@ License: UNKNOWN Project-URL: Bug Tracker, https://bugs.launchpad.net/pbr/ Project-URL: Documentation, https://docs.openstack.org/pbr/ Project-URL: Source Code, https://opendev.org/openstack/pbr -Description: Introduction - ============ - - .. image:: https://img.shields.io/pypi/v/pbr.svg - :target: https://pypi.python.org/pypi/pbr/ - :alt: Latest Version - - .. image:: https://img.shields.io/pypi/dm/pbr.svg - :target: https://pypi.python.org/pypi/pbr/ - :alt: Downloads - - PBR is a library that injects some useful and sensible default behaviors - into your setuptools run. It started off life as the chunks of code that - were copied between all of the `OpenStack`_ projects. Around the time that - OpenStack hit 18 different projects each with at least 3 active branches, - it seemed like a good time to make that code into a proper reusable library. - - PBR is only mildly configurable. The basic idea is that there's a decent - way to run things and if you do, you should reap the rewards, because then - it's simple and repeatable. If you want to do things differently, cool! But - you've already got the power of Python at your fingertips, so you don't - really need PBR. - - PBR builds on top of the work that `d2to1`_ started to provide for declarative - configuration. `d2to1`_ is itself an implementation of the ideas behind - `distutils2`_. Although `distutils2`_ is now abandoned in favor of work towards - `PEP 426`_ and Metadata 2.0, declarative config is still a great idea and - specifically important in trying to distribute setup code as a library - when that library itself will alter how the setup is processed. As Metadata - 2.0 and other modern Python packaging PEPs come out, PBR aims to support - them as quickly as possible. - - * License: Apache License, Version 2.0 - * Documentation: https://docs.openstack.org/pbr/latest/ - * Source: https://opendev.org/openstack/pbr - * Bugs: https://bugs.launchpad.net/pbr - * Release Notes: https://docs.openstack.org/pbr/latest/user/releasenotes.html - * ChangeLog: https://docs.openstack.org/pbr/latest/user/history.html - - .. _d2to1: https://pypi.python.org/pypi/d2to1 - .. _distutils2: https://pypi.python.org/pypi/Distutils2 - .. _PEP 426: http://legacy.python.org/dev/peps/pep-0426/ - .. _OpenStack: https://www.openstack.org/ - - +Description: Python Build Reasonableness Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console diff --git a/doc/source/user/using.rst b/doc/source/user/using.rst index 21aa99b..11cdbf2 100644 --- a/doc/source/user/using.rst +++ b/doc/source/user/using.rst @@ -41,12 +41,12 @@ PBR can be configured as a PEP517 build-system in ``pyproject.toml``. This currently continues to rely on setuptools which means you need the above ``setup.py`` file to be present. The main benefits to using a ``pyproject.toml`` file with PBR are that you can control the versions of -PBR, setuptools, and wheel that are used avoiding easy_install invocation. +PBR and setuptools that are used avoiding easy_install invocation. Your build-system block in ``pyproject.toml`` will need to look something like this:: [build-system] - requires = ["pbr>=5.7.0", "setuptools>=36.6.0", "wheel"] + requires = ["pbr>=5.7.0", "setuptools>=36.6.0"] build-backend = "pbr.build" diff --git a/pbr.egg-info/PKG-INFO b/pbr.egg-info/PKG-INFO index 5847662..ce4212c 100644 --- a/pbr.egg-info/PKG-INFO +++ b/pbr.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pbr -Version: 5.8.1 +Version: 5.9.0 Summary: Python Build Reasonableness Home-page: https://docs.openstack.org/pbr/latest/ Author: OpenStack @@ -9,51 +9,7 @@ License: UNKNOWN Project-URL: Bug Tracker, https://bugs.launchpad.net/pbr/ Project-URL: Documentation, https://docs.openstack.org/pbr/ Project-URL: Source Code, https://opendev.org/openstack/pbr -Description: Introduction - ============ - - .. image:: https://img.shields.io/pypi/v/pbr.svg - :target: https://pypi.python.org/pypi/pbr/ - :alt: Latest Version - - .. image:: https://img.shields.io/pypi/dm/pbr.svg - :target: https://pypi.python.org/pypi/pbr/ - :alt: Downloads - - PBR is a library that injects some useful and sensible default behaviors - into your setuptools run. It started off life as the chunks of code that - were copied between all of the `OpenStack`_ projects. Around the time that - OpenStack hit 18 different projects each with at least 3 active branches, - it seemed like a good time to make that code into a proper reusable library. - - PBR is only mildly configurable. The basic idea is that there's a decent - way to run things and if you do, you should reap the rewards, because then - it's simple and repeatable. If you want to do things differently, cool! But - you've already got the power of Python at your fingertips, so you don't - really need PBR. - - PBR builds on top of the work that `d2to1`_ started to provide for declarative - configuration. `d2to1`_ is itself an implementation of the ideas behind - `distutils2`_. Although `distutils2`_ is now abandoned in favor of work towards - `PEP 426`_ and Metadata 2.0, declarative config is still a great idea and - specifically important in trying to distribute setup code as a library - when that library itself will alter how the setup is processed. As Metadata - 2.0 and other modern Python packaging PEPs come out, PBR aims to support - them as quickly as possible. - - * License: Apache License, Version 2.0 - * Documentation: https://docs.openstack.org/pbr/latest/ - * Source: https://opendev.org/openstack/pbr - * Bugs: https://bugs.launchpad.net/pbr - * Release Notes: https://docs.openstack.org/pbr/latest/user/releasenotes.html - * ChangeLog: https://docs.openstack.org/pbr/latest/user/history.html - - .. _d2to1: https://pypi.python.org/pypi/d2to1 - .. _distutils2: https://pypi.python.org/pypi/Distutils2 - .. _PEP 426: http://legacy.python.org/dev/peps/pep-0426/ - .. _OpenStack: https://www.openstack.org/ - - +Description: Python Build Reasonableness Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console diff --git a/pbr/version.py b/pbr/version.py index 46c6020..658928e 100644 --- a/pbr/version.py +++ b/pbr/version.py @@ -15,13 +15,19 @@ # under the License. """ -Utilities for consuming the version from pkg_resources. +Utilities for consuming the version from importlib-metadata. """ import itertools import operator import sys +try: + import importlib_metadata + use_importlib = True +except ImportError: + use_importlib = False + def _is_int(string): try: @@ -431,12 +437,15 @@ class VersionInfo(object): """Obtain a version from pkg_resources or setup-time logic if missing. This will try to get the version of the package from the pkg_resources + This will try to get the version of the package from the record associated with the package, and if there is no such record + importlib_metadata record associated with the package, and if there falls back to the logic sdist would use. + + is no such record falls back to the logic sdist would use. """ - # Lazy import because pkg_resources is costly to import so defer until - # we absolutely need it. import pkg_resources + try: requirement = pkg_resources.Requirement.parse(self.package) provider = pkg_resources.get_provider(requirement) @@ -447,6 +456,25 @@ class VersionInfo(object): # installed into anything. Revert to setup-time logic. from pbr import packaging result_string = packaging.get_version(self.package) + + return SemanticVersion.from_pip_string(result_string) + + def _get_version_from_importlib_metadata(self): + """Obtain a version from importlib or setup-time logic if missing. + + This will try to get the version of the package from the + importlib_metadata record associated with the package, and if there + is no such record falls back to the logic sdist would use. + """ + try: + distribution = importlib_metadata.distribution(self.package) + result_string = distribution.version + except importlib_metadata.PackageNotFoundError: + # The most likely cause for this is running tests in a tree + # produced from a tarball where the package itself has not been + # installed into anything. Revert to setup-time logic. + from pbr import packaging + result_string = packaging.get_version(self.package) return SemanticVersion.from_pip_string(result_string) def release_string(self): @@ -459,7 +487,12 @@ class VersionInfo(object): def semantic_version(self): """Return the SemanticVersion object for this version.""" if self._semantic is None: - self._semantic = self._get_version_from_pkg_resources() + # TODO(damami): simplify this once Python 3.8 is the oldest + # we support + if use_importlib: + self._semantic = self._get_version_from_importlib_metadata() + else: + self._semantic = self._get_version_from_pkg_resources() return self._semantic def version_string(self): diff --git a/pyproject.toml.future b/pyproject.toml.future index 1989dfd..56fbd2c 100644 --- a/pyproject.toml.future +++ b/pyproject.toml.future @@ -4,6 +4,9 @@ # once we are more confident it works generally. [build-system] -requires = ["setuptools>=36.6.0", "wheel"] +requires = ["setuptools>=36.6.0"] build-backend = "pbr.build" backend-path = ["."] + +[tools.setuptools] +py-modules=[] diff --git a/setup.cfg b/setup.cfg index 141fc7f..5226b3e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,18 +1,16 @@ [metadata] name = pbr author = OpenStack -author-email = openstack-discuss@lists.openstack.org -summary = Python Build Reasonableness -description-file = - README.rst -description-content-type = text/x-rst; charset=UTF-8 -home-page = https://docs.openstack.org/pbr/latest/ +author_email = openstack-discuss@lists.openstack.org +description = Python Build Reasonableness +long_description = file: README.rst +long_description_content_type = text/x-rst; charset=UTF-8 +url = https://docs.openstack.org/pbr/latest/ project_urls = Bug Tracker = https://bugs.launchpad.net/pbr/ Documentation = https://docs.openstack.org/pbr/ Source Code = https://opendev.org/openstack/pbr -python-requires = >=2.6 -classifier = +classifiers = Development Status :: 5 - Production/Stable Environment :: Console Environment :: OpenStack @@ -28,6 +26,9 @@ classifier = Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 +[options] +python_requires = >=2.6 + [files] packages = pbr diff --git a/tox.ini b/tox.ini index e158f90..b3173d6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 3.1 +minversion = 3.18.0 envlist = pep8,py27,py37,docs ignore_basepython_conflict = True @@ -24,7 +24,7 @@ commands = stestr run --suppress-attachments {posargs} commands = pre-commit run -a [testenv:docs] -whitelist_externals = rm +allowlist_externals = rm deps = -r{toxinidir}/doc/requirements.txt commands = @@ -33,7 +33,7 @@ commands = sphinx-build -W -b html doc/source doc/build/html {posargs} [testenv:releasenotes] -whitelist_externals = rm +allowlist_externals = rm deps = {[testenv:docs]deps} commands = rm -rf releasenotes/build -- 2.34.1