From acb0620b2b23c1402ce3c055dd5dce4f9f8752eb Mon Sep 17 00:00:00 2001 From: TizenOpenSource Date: Thu, 28 Dec 2023 18:15:31 +0900 Subject: [PATCH] Imported Upstream version 5.11.1 --- .zuul.yaml | 10 ++++ AUTHORS | 2 + CONTRIBUTING.rst | 5 ++ ChangeLog | 22 +++++++++ PKG-INFO | 4 +- pbr.egg-info/PKG-INFO | 4 +- pbr.egg-info/SOURCES.txt | 1 + pbr/core.py | 10 +--- pbr/packaging.py | 12 +++-- pbr/tests/test_integration.py | 48 ++++++++++++------- pbr/tests/test_packaging.py | 47 ++++++++++++++++++ pbr/tests/test_util.py | 5 +- pbr/version.py | 13 +++-- ...mbols-leading-spaces-f68928d75a8f0997.yaml | 5 ++ setup.cfg | 2 + tools/integration.sh | 11 +---- tox.ini | 21 +++++--- 17 files changed, 169 insertions(+), 53 deletions(-) create mode 100644 releasenotes/notes/fix-symbols-leading-spaces-f68928d75a8f0997.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 87fccb4..3d0908f 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -104,6 +104,14 @@ vars: pbr_pip_version: 'git+https://github.com/pypa/pip.git#egg=pip' +- job: + name: pbr-installation-openstack-focal + parent: pbr-installation-openstack + nodeset: ubuntu-focal + description: | + Run pbr integration testing on older Ubuntu which allows us + to test compatibility with older versions of pip and setuptools. + - project: templates: - lib-forward-testing @@ -120,6 +128,7 @@ - openstack-tox-py38 - openstack-tox-py39 - pbr-installation-openstack + - pbr-installation-openstack-focal - pbr-installation-openstack-pip-dev - tempest-full: override-checkout: stable/train @@ -133,6 +142,7 @@ - openstack-tox-py38 - openstack-tox-py39 - pbr-installation-openstack + - pbr-installation-openstack-focal - pbr-installation-openstack-pip-dev - tempest-full: override-checkout: stable/train diff --git a/AUTHORS b/AUTHORS index d771f1e..d2b3c37 100644 --- a/AUTHORS +++ b/AUTHORS @@ -20,6 +20,7 @@ Cao Xuan Hoang Chang Bo Guo ChangBo Guo(gcb) Chris Dent +Chris Dohmen Christian Berendt Chuck Short Clark Boylan @@ -145,6 +146,7 @@ cbjchen@cn.ibm.com dineshbhor jiansong lifeless +ljhuang manchandavishal melanie witt melissaml diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 33adff5..798ef48 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -9,6 +9,11 @@ the workflow documented at: https://docs.opendev.org/opendev/infra-manual/latest/developers.html#development-workflow +Release notes are managed through the tool +`reno `_. This tool will create +a new file under the directory ``releasenotes`` that should +be checked in with the code changes. + Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: diff --git a/ChangeLog b/ChangeLog index b429d13..1e92d7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,28 @@ CHANGES ======= +5.11.1 +------ + +* Run PBR integration on Ubuntu Focal too +* Remove numpy dependencies +* Tie recursion calls to Dist object, not module +* Update tox.ini to work with tox 4 + +5.11.0 +------ + +* Fix symbol identification in multiline message +* Replace deprecated readfp method with read\_file + +5.10.0 +------ + +* Specify Changelog procedure +* Allow leading spaces when determining symbols +* Use stdlib importlib.metadata where possible +* Adding python classifiers py38 & py39 + 5.9.0 ----- diff --git a/PKG-INFO b/PKG-INFO index ce4212c..24563ef 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pbr -Version: 5.9.0 +Version: 5.11.1 Summary: Python Build Reasonableness Home-page: https://docs.openstack.org/pbr/latest/ Author: OpenStack @@ -25,5 +25,7 @@ Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Requires-Python: >=2.6 Description-Content-Type: text/x-rst; charset=UTF-8 diff --git a/pbr.egg-info/PKG-INFO b/pbr.egg-info/PKG-INFO index ce4212c..24563ef 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.9.0 +Version: 5.11.1 Summary: Python Build Reasonableness Home-page: https://docs.openstack.org/pbr/latest/ Author: OpenStack @@ -25,5 +25,7 @@ Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Requires-Python: >=2.6 Description-Content-Type: text/x-rst; charset=UTF-8 diff --git a/pbr.egg-info/SOURCES.txt b/pbr.egg-info/SOURCES.txt index 484ac63..17351f7 100644 --- a/pbr.egg-info/SOURCES.txt +++ b/pbr.egg-info/SOURCES.txt @@ -103,6 +103,7 @@ releasenotes/notes/fix-handling-of-spaces-in-data-files-glob-0fe0c398d70dfea8.ya releasenotes/notes/fix-keywords-as-cfg-list-6cadc5141429d7f5.yaml releasenotes/notes/fix-mapping-value-explode-with-equal-sign-41bf822fa4dd0e68.yaml releasenotes/notes/fix-pep517-metadata-regression-bc287e60e45b2732.yaml +releasenotes/notes/fix-symbols-leading-spaces-f68928d75a8f0997.yaml releasenotes/notes/ignore-find-links-07cf54f465aa33a6.yaml releasenotes/notes/long-descr-content-type-f9a1003acbb8740f.yaml releasenotes/notes/pep517-support-89189ce0bab15845.yaml diff --git a/pbr/core.py b/pbr/core.py index a801737..fb592f8 100644 --- a/pbr/core.py +++ b/pbr/core.py @@ -61,11 +61,6 @@ else: integer_types = (int, long) # noqa -# We use this canary to detect whether the module has already been called, -# in order to avoid recursion -in_use = False - - def pbr(dist, attr, value): """Implements the actual pbr setup() keyword. @@ -91,10 +86,9 @@ def pbr(dist, attr, value): # particularly when using PEP517 build-system configs without # setup_requires in setup.py. We can avoid the recursion by setting # this canary so we don't repeat ourselves. - global in_use - if in_use: + if hasattr(dist, '_pbr_initialized'): return - in_use = True + dist._pbr_initialized = True if not value: return diff --git a/pbr/packaging.py b/pbr/packaging.py index 8577b53..474d013 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -692,12 +692,14 @@ def _get_increment_kwargs(git_dir, tag): # git log output affecting out ability to have working sem ver headers. changelog = git._run_git_command(['log', '--pretty=%B', version_spec], git_dir) - header_len = len('sem-ver:') - commands = [line[header_len:].strip() for line in changelog.split('\n') - if line.lower().startswith('sem-ver:')] symbols = set() - for command in commands: - symbols.update([symbol.strip() for symbol in command.split(',')]) + header = 'sem-ver:' + for line in changelog.split("\n"): + line = line.lower().strip() + if not line.lower().strip().startswith(header): + continue + new_symbols = line[len(header):].strip().split(",") + symbols.update([symbol.strip() for symbol in new_symbols]) def _handle_symbol(symbol, symbols, impact): if symbol in symbols: diff --git a/pbr/tests/test_integration.py b/pbr/tests/test_integration.py index 25473b0..2f5c0ab 100644 --- a/pbr/tests/test_integration.py +++ b/pbr/tests/test_integration.py @@ -210,20 +210,24 @@ class TestMarkersPip(base.BaseTestCase): scenarios = [ ('pip-latest', {'modules': ['pip']}), - ('setuptools-Bionic', { - 'modules': ['pip==9.0.1', 'setuptools==39.0.1']}), - ('setuptools-Stretch', { - 'modules': ['pip==9.0.1', 'setuptools==33.1.1']}), - ('setuptools-EL8', {'modules': ['pip==9.0.3', 'setuptools==39.2.0']}), - ('setuptools-Buster', { - 'modules': ['pip==18.1', 'setuptools==40.8.0']}), - ('setuptools-Focal', { - 'modules': ['pip==20.0.2', 'setuptools==45.2.0']}), + ( + 'setuptools-Bullseye', + {'modules': ['pip==20.3.4', 'setuptools==52.0.0']}, + ), + ( + 'setuptools-Focal', + {'modules': ['pip==20.0.2', 'setuptools==45.2.0']}, + ), + ( + 'setuptools-Jammy', + {'modules': ['pip==22.0.2', 'setuptools==59.6.0']}, + ), ] @testtools.skipUnless( os.environ.get('PBR_INTEGRATION', None) == '1', - 'integration tests not enabled') + 'integration tests not enabled', + ) def test_pip_versions(self): pkgs = { 'test_markers': @@ -260,21 +264,33 @@ class TestMarkersPip(base.BaseTestCase): allow_fail=False)[0]) -class TestLTSSupport(base.BaseTestCase): - - # These versions come from the versions installed from the 'virtualenv' - # command from the 'python-virtualenv' package. - scenarios = [ +# Handle collections.abc moves in python breaking old pip +# These versions come from the versions installed from the 'virtualenv' +# command from the 'python-virtualenv' package. +if sys.version_info[0:3] < (3, 10, 0): + lts_scenarios = [ ('Bionic', {'modules': ['pip==9.0.1', 'setuptools==39.0.1']}), ('Stretch', {'modules': ['pip==9.0.1', 'setuptools==33.1.1']}), ('EL8', {'modules': ['pip==9.0.3', 'setuptools==39.2.0']}), ('Buster', {'modules': ['pip==18.1', 'setuptools==40.8.0']}), ('Focal', {'modules': ['pip==20.0.2', 'setuptools==45.2.0']}), ] +else: + lts_scenarios = [ + ('Bullseye', {'modules': ['pip==20.3.4', 'setuptools==52.0.0']}), + ('Focal', {'modules': ['pip==20.0.2', 'setuptools==45.2.0']}), + ('Jammy', {'modules': ['pip==22.0.2', 'setuptools==59.6.0']}), + ] + + +class TestLTSSupport(base.BaseTestCase): + + scenarios = lts_scenarios @testtools.skipUnless( os.environ.get('PBR_INTEGRATION', None) == '1', - 'integration tests not enabled') + 'integration tests not enabled', + ) def test_lts_venv_default_versions(self): venv = self.useFixture( test_packaging.Venv('setuptools', modules=self.modules)) diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py index c92ea9b..c719d1e 100644 --- a/pbr/tests/test_packaging.py +++ b/pbr/tests/test_packaging.py @@ -672,6 +672,53 @@ class TestVersions(base.BaseTestCase): version = packaging._get_version_from_git() self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) + def test_multi_inline_symbols_no_space(self): + self.repo.commit() + self.repo.tag('1.2.3') + self.repo.commit('Sem-ver: feature,api-break') + version = packaging._get_version_from_git() + self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) + + def test_multi_inline_symbols_spaced(self): + self.repo.commit() + self.repo.tag('1.2.3') + self.repo.commit('Sem-ver: feature, api-break') + version = packaging._get_version_from_git() + self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) + + def test_multi_inline_symbols_reversed(self): + self.repo.commit() + self.repo.tag('1.2.3') + self.repo.commit('Sem-ver: api-break,feature') + version = packaging._get_version_from_git() + self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) + + def test_leading_space(self): + self.repo.commit() + self.repo.tag('1.2.3') + self.repo.commit(' sem-ver: api-break') + version = packaging._get_version_from_git() + self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) + + def test_leading_space_multiline(self): + self.repo.commit() + self.repo.tag('1.2.3') + self.repo.commit( + ( + ' Some cool text\n' + ' sem-ver: api-break' + ) + ) + version = packaging._get_version_from_git() + self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) + + def test_leading_characters_symbol_not_found(self): + self.repo.commit() + self.repo.tag('1.2.3') + self.repo.commit(' ssem-ver: api-break') + version = packaging._get_version_from_git() + self.assertThat(version, matchers.StartsWith('1.2.4.dev1')) + def test_tagged_version_has_tag_version(self): self.repo.commit() self.repo.tag('1.2.3') diff --git a/pbr/tests/test_util.py b/pbr/tests/test_util.py index f372d65..b25d0c7 100644 --- a/pbr/tests/test_util.py +++ b/pbr/tests/test_util.py @@ -27,12 +27,13 @@ from pbr import util def config_from_ini(ini): config = {} + ini = textwrap.dedent(six.u(ini)) if sys.version_info >= (3, 2): parser = configparser.ConfigParser() + parser.read_file(io.StringIO(ini)) else: parser = configparser.SafeConfigParser() - ini = textwrap.dedent(six.u(ini)) - parser.readfp(io.StringIO(ini)) + parser.readfp(io.StringIO(ini)) for section in parser.sections(): config[section] = dict(parser.items(section)) return config diff --git a/pbr/version.py b/pbr/version.py index 658928e..37c7a9f 100644 --- a/pbr/version.py +++ b/pbr/version.py @@ -22,11 +22,16 @@ import itertools import operator import sys -try: - import importlib_metadata +# TODO(stephenfin): Remove this once we drop support for Python < 3.8 +if sys.version_info >= (3, 8): + from importlib import metadata as importlib_metadata use_importlib = True -except ImportError: - use_importlib = False +else: + try: + import importlib_metadata + use_importlib = True + except ImportError: + use_importlib = False def _is_int(string): diff --git a/releasenotes/notes/fix-symbols-leading-spaces-f68928d75a8f0997.yaml b/releasenotes/notes/fix-symbols-leading-spaces-f68928d75a8f0997.yaml new file mode 100644 index 0000000..f15c9ee --- /dev/null +++ b/releasenotes/notes/fix-symbols-leading-spaces-f68928d75a8f0997.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fix an issue where symbols that were indented + would produce an incorrect version. \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 5226b3e..f0c4e9d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,8 @@ classifiers = Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 [options] python_requires = >=2.6 diff --git a/tools/integration.sh b/tools/integration.sh index 13480f9..f0ed0f2 100644 --- a/tools/integration.sh +++ b/tools/integration.sh @@ -32,15 +32,8 @@ REPODIR=${REPODIR:-$BASE/openstack} sudo apt-get update sudo apt-get install -y --force-yes libvirt-dev libxml2-dev libxslt-dev libmysqlclient-dev libpq-dev libnspr4-dev pkg-config libsqlite3-dev libffi-dev libldap2-dev libsasl2-dev ccache libkrb5-dev liberasurecode-dev libjpeg-dev libsystemd-dev libnss3-dev libssl-dev -# FOR numpy / pyyaml -# The source list has been removed from our apt config so rather than -# installing deps via apt-get build-dep we install the lists provied -# by apt-cache showsrc - -# Numpy -sudo apt-get install -y --force-yes cython debhelper gfortran libblas-dev liblapack-dev python-all-dbg python-all-dev python-nose python-tz python3-all-dbg python3-all-dev python3-nose python3-tz -#pyyaml -sudo apt-get install -y --force-yes debhelper python-all-dev python-all-dbg python3-all-dev python3-all-dbg libyaml-dev cython cython-dbg quilt +# FOR pyyaml +sudo apt-get install -y --force-yes debhelper python3-all-dev python3-all-dbg libyaml-dev cython3 cython3-dbg quilt # And use ccache explitly export PATH=/usr/lib/ccache:$PATH diff --git a/tox.ini b/tox.ini index b3173d6..7330024 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,17 @@ [tox] minversion = 3.18.0 -envlist = pep8,py27,py37,docs -ignore_basepython_conflict = True +envlist = pep8,py3,docs [testenv] -usedevelop = True -basepython = python3 -passenv = PBR_INTEGRATION PIPFLAGS PIPVERSION PBRVERSION REPODIR WHEELHOUSE PROJECTS +usedevelop = true +passenv = + PBR_INTEGRATION + PIPFLAGS + PIPVERSION + PBRVERSION + REPODIR + WHEELHOUSE + PROJECTS # TODO(fungi): drop distutils override once logging improves in Setuptools # https://github.com/pypa/setuptools/issues/3038 setenv = @@ -24,7 +29,8 @@ commands = stestr run --suppress-attachments {posargs} commands = pre-commit run -a [testenv:docs] -allowlist_externals = rm +allowlist_externals = + rm deps = -r{toxinidir}/doc/requirements.txt commands = @@ -33,7 +39,8 @@ commands = sphinx-build -W -b html doc/source doc/build/html {posargs} [testenv:releasenotes] -allowlist_externals = rm +allowlist_externals = + rm deps = {[testenv:docs]deps} commands = rm -rf releasenotes/build -- 2.34.1