From: DongHun Kwak Date: Mon, 18 Jul 2022 01:15:37 +0000 (+0900) Subject: Imported Upstream version 5.8.1 X-Git-Tag: upstream/5.8.1^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1d77a600432cc8405a796a269c9d7e20f5b484d0;p=platform%2Fupstream%2Fpython3-pbr.git Imported Upstream version 5.8.1 --- diff --git a/AUTHORS b/AUTHORS index eb2fe0d..c43d177 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,6 +10,7 @@ Angus Salkeld Anthony Young Antoine Musso Attila Fazekas +Ben Greiner Ben Nemec Bhuvan Arumugam Brandon LeBlanc diff --git a/ChangeLog b/ChangeLog index 0122998..0b05c75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,15 @@ CHANGES ======= +5.8.1 +----- + +* Add release note about missing pbr.json fix +* Avoid recursive calls into SetupTools entrypoint +* remove explicit mock +* Don't test with setuptools local distutils +* Use context blocks for open() calls in packaging + 5.8.0 ----- diff --git a/PKG-INFO b/PKG-INFO index ccf0c2a..5847662 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pbr -Version: 5.8.0 +Version: 5.8.1 Summary: Python Build Reasonableness Home-page: https://docs.openstack.org/pbr/latest/ Author: OpenStack diff --git a/pbr.egg-info/PKG-INFO b/pbr.egg-info/PKG-INFO index ccf0c2a..5847662 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.0 +Version: 5.8.1 Summary: Python Build Reasonableness Home-page: https://docs.openstack.org/pbr/latest/ Author: OpenStack diff --git a/pbr.egg-info/SOURCES.txt b/pbr.egg-info/SOURCES.txt index ed0daa2..484ac63 100644 --- a/pbr.egg-info/SOURCES.txt +++ b/pbr.egg-info/SOURCES.txt @@ -102,6 +102,7 @@ releasenotes/notes/fix-global-replace-of-src-prefix-in-glob-eb850b94ca96993e.yam releasenotes/notes/fix-handling-of-spaces-in-data-files-glob-0fe0c398d70dfea8.yaml 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/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 f221299..a801737 100644 --- a/pbr/core.py +++ b/pbr/core.py @@ -61,6 +61,11 @@ 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. @@ -81,6 +86,16 @@ def pbr(dist, attr, value): not work well with distributions that do use a `Distribution` subclass. """ + # Distribution.finalize_options() is what calls this method. That means + # there is potential for recursion here. Recursion seems to be an issue + # 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: + return + in_use = True + if not value: return if isinstance(value, string_type): @@ -130,14 +145,6 @@ def pbr(dist, attr, value): msg = 'Unknown distribution option: %s' % repr(key) warnings.warn(msg) - # Distribution.finalize_options() is what calls this method. That means - # there is potential for recursion here. Recursion seems to be an issue - # particularly when using PEP517 build-system configs without - # setup_requires in setup.py. We can avoid the recursion by setting - # dist.pbr to a None value as the corresponding entrypoint (this function) - # will only be called on a non None value. - setattr(dist, "pbr", None) - # Re-finalize the underlying Distribution try: super(dist.__class__, dist).finalize_options() diff --git a/pbr/packaging.py b/pbr/packaging.py index ae07796..8577b53 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -581,8 +581,9 @@ class LocalEggInfo(egg_info.egg_info): else: log.info("[pbr] Reusing existing SOURCES.txt") self.filelist = egg_info.FileList() - for entry in open(manifest_filename, 'r').read().split('\n'): - self.filelist.append(entry) + with open(manifest_filename, 'r') as fil: + for entry in fil.read().split('\n'): + self.filelist.append(entry) def _from_git(distribution): @@ -823,12 +824,9 @@ def _get_version_from_pkg_metadata(package_name): pkg_metadata = {} for filename in pkg_metadata_filenames: try: - pkg_metadata_file = open(filename, 'r') - except (IOError, OSError): - continue - try: - pkg_metadata = email.message_from_file(pkg_metadata_file) - except email.errors.MessageError: + with open(filename, 'r') as pkg_metadata_file: + pkg_metadata = email.message_from_file(pkg_metadata_file) + except (IOError, OSError, email.errors.MessageError): continue # Check to make sure we're in our own dir diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py index 7735053..c92ea9b 100644 --- a/pbr/tests/test_packaging.py +++ b/pbr/tests/test_packaging.py @@ -48,7 +48,10 @@ import tempfile import textwrap import fixtures -import mock +try: + from unittest import mock +except ImportError: + import mock import pkg_resources import six import testscenarios @@ -378,6 +381,12 @@ class TestPackagingWheels(base.BaseTestCase): wheel_file.extractall(self.extracted_wheel_dir) wheel_file.close() + def test_metadata_directory_has_pbr_json(self): + # Build the path to the scripts directory + pbr_json = os.path.join( + self.extracted_wheel_dir, 'pbr_testpackage-0.0.dist-info/pbr.json') + self.assertTrue(os.path.exists(pbr_json)) + def test_data_directory_has_wsgi_scripts(self): # Build the path to the scripts directory scripts_dir = os.path.join( diff --git a/pbr/tests/test_pbr_json.py b/pbr/tests/test_pbr_json.py index f066971..eb9a08a 100644 --- a/pbr/tests/test_pbr_json.py +++ b/pbr/tests/test_pbr_json.py @@ -10,7 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +try: + from unittest import mock +except ImportError: + import mock from pbr import pbr_json from pbr.tests import base diff --git a/releasenotes/notes/fix-pep517-metadata-regression-bc287e60e45b2732.yaml b/releasenotes/notes/fix-pep517-metadata-regression-bc287e60e45b2732.yaml new file mode 100644 index 0000000..c056700 --- /dev/null +++ b/releasenotes/notes/fix-pep517-metadata-regression-bc287e60e45b2732.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Packages generated with the 5.8.0 release of PBR failed to incorporate + pbr.json metadata files. This is now corrected. Users can rebuild packages + with newer PBR if they want that missing metadata generated. diff --git a/test-requirements.txt b/test-requirements.txt index 4d586e4..3af261d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,7 +6,6 @@ wheel>=0.32.0 # MIT fixtures>=3.0.0 # Apache-2.0/BSD hacking>=1.1.0,<4.0.0;python_version>='3.6' # Apache-2.0 mock>=2.0.0,<4.0.0;python_version=='2.7' # BSD -mock>=2.0.0;python_version>='3.6' # BSD six>=1.12.0 # MIT stestr>=2.1.0,<3.0;python_version=='2.7' # Apache-2.0 stestr>=2.1.0;python_version>='3.0' # Apache-2.0 diff --git a/tox.ini b/tox.ini index 549dd4e..e158f90 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,10 @@ ignore_basepython_conflict = True usedevelop = True basepython = python3 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 = + SETUPTOOLS_USE_DISTUTILS=stdlib OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:1} OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:1} OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:60} @@ -40,7 +43,10 @@ commands = commands = {posargs} [testenv:cover] +# TODO(fungi): drop distutils override once logging improves in Setuptools +# https://github.com/pypa/setuptools/issues/3038 setenv = + SETUPTOOLS_USE_DISTUTILS=stdlib PYTHON=coverage run --source pbr --parallel-mode commands = stestr run {posargs}