Imported Upstream version 5.6.0 upstream/5.6.0
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 18 Jul 2022 01:13:53 +0000 (10:13 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 18 Jul 2022 01:13:53 +0000 (10:13 +0900)
17 files changed:
.pre-commit-config.yaml [new file with mode: 0644]
.zuul.yaml
AUTHORS
ChangeLog
PKG-INFO
doc/requirements.txt
doc/source/conf.py
lower-constraints.txt [deleted file]
pbr.egg-info/PKG-INFO
pbr.egg-info/SOURCES.txt
pbr/tests/test_packaging.py
pbr/tests/test_setup.py
pbr/tests/test_util.py
pbr/util.py
test-requirements.txt
tools/integration.sh
tox.ini

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..2f6ad7b
--- /dev/null
@@ -0,0 +1,39 @@
+# We from the Oslo project decided to pin repos based on the
+# commit hash instead of the version tag to prevend arbitrary
+# code from running in developer's machines.  To update to a
+# newer version, run `pre-commit autoupdate` and then replace
+# the newer versions with their commit hash.
+
+default_language_version:
+  python: python3
+
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: ebc15addedad713c86ef18ae9632c88e187dd0af  # v3.1.0
+    hooks:
+      - id: trailing-whitespace
+      # Replaces or checks mixed line ending
+      - id: mixed-line-ending
+        args: ['--fix', 'lf']
+        exclude: '.*\.(svg)$'
+      # Forbid files which have a UTF-8 byte-order marker
+      - id: check-byte-order-marker
+      # Checks that non-binary executables have a proper shebang
+      - id: check-executables-have-shebangs
+      # Check for files that contain merge conflict strings.
+      - id: check-merge-conflict
+      # Check for debugger imports and py37+ breakpoint()
+      # calls in python source
+      - id: debug-statements
+      - id: check-yaml
+        files: .*\.(yaml|yml)$
+  - repo: local
+    hooks:
+      - id: flake8
+        name: flake8
+        additional_dependencies:
+          - hacking>=4.0.0,<4.1.0
+        language: python
+        entry: flake8
+        files: '^.*\.py$'
+        exclude: '^(doc|releasenotes|tools)/.*$'
index ba9b3fa01a2ae4fb3324097e2e527ff81b688fd6..176586401f5ff3cd0977fd52d8dddbd6c0cdb57e 100644 (file)
       - lib-forward-testing
       - lib-forward-testing-python3
       - openstack-cover-jobs
-      - openstack-lower-constraints-jobs
       - openstack-python-jobs
       - openstack-python3-ussuri-jobs
       - periodic-stable-jobs
diff --git a/AUTHORS b/AUTHORS
index 17a7b62d3d73a7f0912fd8bfe545475b5f5443d2..9587345cc343b62c41dbcecdc5c0d6a34733a6d7 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -25,6 +25,7 @@ Clark Boylan <clark.boylan@gmail.com>
 Claudiu Popa <cpopa@cloudbasesolutions.com>
 Corey Bryant <corey.bryant@canonical.com>
 Dan Prince <dprince@redhat.com>
+Daniel Bengtsson <dbengt@redhat.com>
 Darragh Bailey <dbailey@hp.com>
 Davanum Srinivas <dims@linux.vnet.ibm.com>
 Dave Walker (Daviey) <email@daviey.com>
index 170a1fadc57774c123155b3fa85637e88292c67a..84c9827af2c8ed26ab4e1fe11e8cbba2704c04f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,22 @@
 CHANGES
 =======
 
+5.6.0
+-----
+
+* Reverse ordering of 'D1\_D2\_SETUP\_ARGS'
+* Add test for cfg -> py transformation
+* Don't pass empty 'long\_description'
+* Move flake8 as a pre-commit local target
+* Map requires-python to python-requires (attempt 2)
+* Update dependencies to avoid failure with old pip
+* Increase OS\_TEST\_TIMEOUT to 1200
+* Prevent test failure due to use of setpref
+* util: Convert 'D1\_D2\_SETUP\_ARGS' to a list of tuples
+* Revert "Map requires-python to python-requires"
+* Dropping lower constraints testing
+* Adding pre-commit
+
 5.5.1
 -----
 
index 7df18044f8a3c899aa0127b06bcb83d94d4de34f..8efb07a364cd98325cb75ac682e749c45b3fb267 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pbr
-Version: 5.5.1
+Version: 5.6.0
 Summary: Python Build Reasonableness
 Home-page: https://docs.openstack.org/pbr/latest/
 Author: OpenStack
index d0c1f36378252472fa9942654e005d2c98c49ea6..34ce8bac08aa0487f3567ef08f408e70a3759e82 100644 (file)
@@ -3,3 +3,4 @@ sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
 sphinxcontrib-apidoc>=0.2.0  # BSD
 openstackdocstheme>=1.18.1 # Apache-2.0
 reno>=2.5.0 # Apache-2.0
+six==1.12.0 # MIT
index aa51538ffc85f5350772e78d966079896140800f..d86c682b4277c45575d024f93443a9f9302f12b0 100644 (file)
@@ -1,4 +1,17 @@
 # -*- coding: utf-8 -*-
+# Copyright (C) 2020 Red Hat, Inc.
+#
+# 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
 import sys
diff --git a/lower-constraints.txt b/lower-constraints.txt
deleted file mode 100644 (file)
index 46ad80b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-alabaster==0.7.10
-Babel==2.3.4
-docutils==0.11
-dulwich==0.15.0
-extras==1.0.0
-fixtures==3.0.0
-flake8==2.5.5
-hacking==0.12.0
-imagesize==0.7.1
-Jinja2==2.10
-linecache2==1.0.0
-MarkupSafe==1.0
-mccabe==0.2.1
-mock==2.0.0
-openstackdocstheme==1.18.1
-pep8==1.5.7
-pyflakes==0.8.1
-Pygments==2.2.0
-python-mimeparse==1.6.0
-python-subunit==1.0.0
-pytz==2013.6
-PyYAML==3.12
-reno==2.5.0
-requests==2.14.2
-six==1.12.0
-snowballstemmer==1.2.1
-Sphinx==1.6.5
-sphinxcontrib-apidoc==0.2.0
-sphinxcontrib-websupport==1.0.1
-stestr==2.1.0
-testrepository==0.0.18
-testresources==2.0.0
-testscenarios==0.4
-testtools==2.2.0
-traceback2==1.4.0
-unittest2==1.1.0
-virtualenv==20.0.3
index 7df18044f8a3c899aa0127b06bcb83d94d4de34f..8efb07a364cd98325cb75ac682e749c45b3fb267 100644 (file)
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pbr
-Version: 5.5.1
+Version: 5.6.0
 Summary: Python Build Reasonableness
 Home-page: https://docs.openstack.org/pbr/latest/
 Author: OpenStack
index 779cbf3af4ee997f46f2bce6ece183fc666a92e1..2fbcb1dff43223a5cbfb88d3d3f5f8e46146895b 100644 (file)
@@ -1,5 +1,6 @@
 .coveragerc
 .mailmap
+.pre-commit-config.yaml
 .stestr.conf
 .zuul.yaml
 AUTHORS
@@ -7,7 +8,6 @@ CONTRIBUTING.rst
 ChangeLog
 LICENSE
 README.rst
-lower-constraints.txt
 setup.cfg
 setup.py
 test-requirements.txt
index 3a703194b11c7aaf72ac257cd5f37adb57cecc89..9e95a86808612a15b4f6e9fc780113bba4188abf 100644 (file)
@@ -135,7 +135,6 @@ class GPGKeyFixture(fixtures.Fixture):
             Name-Comment: N/A
             Name-Email: example@example.com
             Expire-Date: 2d
-            Preferences: (setpref)
             %commit
             """)
 
index d171d7c098fe8c83dcd41efccfffbf80e365e15c..43077088d7df248c28f34d36022d430786c737d5 100644 (file)
@@ -218,9 +218,9 @@ class GitLogsTest(base.BaseTestCase):
 
         with open(os.path.join(self.temp_path, "AUTHORS"), "r") as auth_fh:
             authors = auth_fh.read()
-            self.assertTrue(author_old in authors)
-            self.assertTrue(author_new in authors)
-            self.assertTrue(co_author in authors)
+            self.assertIn(author_old, authors)
+            self.assertIn(author_new, authors)
+            self.assertIn(co_author, authors)
 
 
 class _SphinxConfig(object):
index 0a02fc1b6368275a84c3ef741fd01e10a03b4a73..f372d6590d29b5dd34e508038cf25c932c6912a8 100644 (file)
@@ -38,6 +38,108 @@ def config_from_ini(ini):
     return config
 
 
+class TestBasics(base.BaseTestCase):
+
+    def test_basics(self):
+        self.maxDiff = None
+        config_text = """
+            [metadata]
+            name = foo
+            version = 1.0
+            author = John Doe
+            author_email = jd@example.com
+            maintainer = Jim Burke
+            maintainer_email = jb@example.com
+            home_page = http://example.com
+            summary = A foobar project.
+            description = Hello, world. This is a long description.
+            download_url = http://opendev.org/x/pbr
+            classifier =
+                Development Status :: 5 - Production/Stable
+                Programming Language :: Python
+            platform =
+                any
+            license = Apache 2.0
+            requires_dist =
+                Sphinx
+                requests
+            setup_requires_dist =
+                docutils
+            python_requires = >=3.6
+            provides_dist =
+                bax
+            provides_extras =
+                bar
+            obsoletes_dist =
+                baz
+
+            [files]
+            packages_root = src
+            packages =
+                foo
+            package_data =
+                "" = *.txt, *.rst
+                foo = *.msg
+            namespace_packages =
+                hello
+            data_files =
+                bitmaps =
+                    bm/b1.gif
+                    bm/b2.gif
+                config =
+                    cfg/data.cfg
+            scripts =
+                scripts/hello-world.py
+            modules =
+                mod1
+            """
+        expected = {
+            'name': u'foo',
+            'version': u'1.0',
+            'author': u'John Doe',
+            'author_email': u'jd@example.com',
+            'maintainer': u'Jim Burke',
+            'maintainer_email': u'jb@example.com',
+            'url': u'http://example.com',
+            'description': u'A foobar project.',
+            'long_description': u'Hello, world. This is a long description.',
+            'download_url': u'http://opendev.org/x/pbr',
+            'classifiers': [
+                u'Development Status :: 5 - Production/Stable',
+                u'Programming Language :: Python',
+            ],
+            'platforms': [u'any'],
+            'license': u'Apache 2.0',
+            'install_requires': [
+                u'Sphinx',
+                u'requests',
+            ],
+            'setup_requires': [u'docutils'],
+            'python_requires': u'>=3.6',
+            'provides': [u'bax'],
+            'provides_extras': [u'bar'],
+            'obsoletes': [u'baz'],
+            'extras_require': {},
+
+            'package_dir': {'': u'src'},
+            'packages': [u'foo'],
+            'package_data': {
+                '': ['*.txt,', '*.rst'],
+                'foo': ['*.msg'],
+            },
+            'namespace_packages': [u'hello'],
+            'data_files': [
+                ('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
+                ('config', ['cfg/data.cfg']),
+            ],
+            'scripts': [u'scripts/hello-world.py'],
+            'py_modules': [u'mod1'],
+        }
+        config = config_from_ini(config_text)
+        actual = util.setup_cfg_to_setup_kwargs(config)
+        self.assertDictEqual(expected, actual)
+
+
 class TestExtrasRequireParsingScenarios(base.BaseTestCase):
 
     scenarios = [
@@ -197,8 +299,7 @@ class TestDataFilesParsing(base.BaseTestCase):
         config = config_from_ini(self.config_text)
         kwargs = util.setup_cfg_to_setup_kwargs(config)
 
-        self.assertEqual(self.data_files,
-                         list(kwargs['data_files']))
+        self.assertEqual(self.data_files, kwargs['data_files'])
 
 
 class TestUTF8DescriptionFile(base.BaseTestCase):
index 6e8d23148e1fb596b8520521a20143c631672e94..75a7ebb4d64c588212c26a37e23363df4949dd16 100644 (file)
@@ -92,47 +92,50 @@ _VERSION_SPEC_RE = re.compile(r'\s*(.*?)\s*\((.*)\)\s*$')
 # Mappings from setup() keyword arguments to setup.cfg options;
 # The values are (section, option) tuples, or simply (section,) tuples if
 # the option has the same name as the setup() argument
-D1_D2_SETUP_ARGS = {
-    "name": ("metadata",),
-    "version": ("metadata",),
-    "author": ("metadata",),
-    "author_email": ("metadata",),
-    "maintainer": ("metadata",),
-    "maintainer_email": ("metadata",),
-    "url": ("metadata", "home_page"),
-    "project_urls": ("metadata",),
-    "description": ("metadata", "summary"),
-    "keywords": ("metadata",),
-    "long_description": ("metadata", "description"),
-    "long_description_content_type": ("metadata", "description_content_type"),
-    "download_url": ("metadata",),
-    "classifiers": ("metadata", "classifier"),
-    "platforms": ("metadata", "platform"),  # **
-    "license": ("metadata",),
+CFG_TO_PY_SETUP_ARGS = (
+    (('metadata', 'name'), 'name'),
+    (('metadata', 'version'), 'version'),
+    (('metadata', 'author'), 'author'),
+    (('metadata', 'author_email'), 'author_email'),
+    (('metadata', 'maintainer'), 'maintainer'),
+    (('metadata', 'maintainer_email'), 'maintainer_email'),
+    (('metadata', 'home_page'), 'url'),
+    (('metadata', 'project_urls'), 'project_urls'),
+    (('metadata', 'summary'), 'description'),
+    (('metadata', 'keywords'), 'keywords'),
+    (('metadata', 'description'), 'long_description'),
+    (
+        ('metadata', 'description_content_type'),
+        'long_description_content_type',
+    ),
+    (('metadata', 'download_url'), 'download_url'),
+    (('metadata', 'classifier'), 'classifiers'),
+    (('metadata', 'platform'), 'platforms'),  # **
+    (('metadata', 'license'), 'license'),
     # Use setuptools install_requires, not
     # broken distutils requires
-    "install_requires": ("metadata", "requires_dist"),
-    "setup_requires": ("metadata", "setup_requires_dist"),
-    "python_requires": ("metadata",),
-    "requires_python": ("metadata", "python_requires"),
-    "provides": ("metadata", "provides_dist"),  # **
-    "provides_extras": ("metadata",),
-    "obsoletes": ("metadata", "obsoletes_dist"),  # **
-    "package_dir": ("files", 'packages_root'),
-    "packages": ("files",),
-    "package_data": ("files",),
-    "namespace_packages": ("files",),
-    "data_files": ("files",),
-    "scripts": ("files",),
-    "py_modules": ("files", "modules"),   # **
-    "cmdclass": ("global", "commands"),
+    (('metadata', 'requires_dist'), 'install_requires'),
+    (('metadata', 'setup_requires_dist'), 'setup_requires'),
+    (('metadata', 'python_requires'), 'python_requires'),
+    (('metadata', 'requires_python'), 'python_requires'),
+    (('metadata', 'provides_dist'), 'provides'),  # **
+    (('metadata', 'provides_extras'), 'provides_extras'),
+    (('metadata', 'obsoletes_dist'), 'obsoletes'),  # **
+    (('files', 'packages_root'), 'package_dir'),
+    (('files', 'packages'), 'packages'),
+    (('files', 'package_data'), 'package_data'),
+    (('files', 'namespace_packages'), 'namespace_packages'),
+    (('files', 'data_files'), 'data_files'),
+    (('files', 'scripts'), 'scripts'),
+    (('files', 'modules'), 'py_modules'),   # **
+    (('global', 'commands'), 'cmdclass'),
     # Not supported in distutils2, but provided for
     # backwards compatibility with setuptools
-    "zip_safe": ("backwards_compat", "zip_safe"),
-    "tests_require": ("backwards_compat", "tests_require"),
-    "dependency_links": ("backwards_compat",),
-    "include_package_data": ("backwards_compat",),
-}
+    (('backwards_compat', 'zip_safe'), 'zip_safe'),
+    (('backwards_compat', 'tests_require'), 'tests_require'),
+    (('backwards_compat', 'dependency_links'), 'dependency_links'),
+    (('backwards_compat', 'include_package_data'), 'include_package_data'),
+)
 
 # setup() arguments that can have multiple values in setup.cfg
 MULTI_FIELDS = ("classifiers",
@@ -312,34 +315,25 @@ def setup_cfg_to_setup_kwargs(config, script_args=()):
     # parse env_markers.
     all_requirements = {}
 
-    for arg in D1_D2_SETUP_ARGS:
-        if len(D1_D2_SETUP_ARGS[arg]) == 2:
-            # The distutils field name is different than distutils2's.
-            section, option = D1_D2_SETUP_ARGS[arg]
-
-        elif len(D1_D2_SETUP_ARGS[arg]) == 1:
-            # The distutils field name is the same thant distutils2's.
-            section = D1_D2_SETUP_ARGS[arg][0]
-            option = arg
+    for alias, arg in CFG_TO_PY_SETUP_ARGS:
+        section, option = alias
 
         in_cfg_value = has_get_option(config, section, option)
+        if not in_cfg_value and arg == "long_description":
+            in_cfg_value = has_get_option(config, section, "description_file")
+            if in_cfg_value:
+                in_cfg_value = split_multiline(in_cfg_value)
+                value = ''
+                for filename in in_cfg_value:
+                    description_file = io.open(filename, encoding='utf-8')
+                    try:
+                        value += description_file.read().strip() + '\n\n'
+                    finally:
+                        description_file.close()
+                in_cfg_value = value
+
         if not in_cfg_value:
-            # There is no such option in the setup.cfg
-            if arg == "long_description":
-                in_cfg_value = has_get_option(config, section,
-                                              "description_file")
-                if in_cfg_value:
-                    in_cfg_value = split_multiline(in_cfg_value)
-                    value = ''
-                    for filename in in_cfg_value:
-                        description_file = io.open(filename, encoding='utf-8')
-                        try:
-                            value += description_file.read().strip() + '\n\n'
-                        finally:
-                            description_file.close()
-                    in_cfg_value = value
-            else:
-                continue
+            continue
 
         if arg in CSV_FIELDS:
             in_cfg_value = split_csv(in_cfg_value)
@@ -405,7 +399,7 @@ def setup_cfg_to_setup_kwargs(config, script_args=()):
                 if arg == 'data_files':
                     # the data_files value is a pointlessly different structure
                     # from the package_data value
-                    data_files = data_files.items()
+                    data_files = sorted(data_files.items())
                 in_cfg_value = data_files
             elif arg == 'cmdclass':
                 cmdclass = {}
index a3c5a1107b564182b5f5af8290f13dda74aa77ec..4d586e41b2c0e838c8209cb9063fe7eca357f5d0 100644 (file)
@@ -4,8 +4,9 @@
 
 wheel>=0.32.0 # MIT
 fixtures>=3.0.0 # Apache-2.0/BSD
-hacking>=1.1.0,<4.0.0 # Apache-2.0
-mock>=2.0.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
@@ -19,3 +20,5 @@ coverage!=4.4,>=4.0 # Apache-2.0
 sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
 sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
 testrepository>=0.0.18 # Apache-2.0/BSD
+
+pre-commit>=2.6.0;python_version>='3.6' # MIT
index 566fc50c610c40e8d1bab5c6c2bb87ef96f8f24a..13480f9f83bb76fb5a148a6aa2410bb5b000ee25 100644 (file)
@@ -160,7 +160,7 @@ export PBRVERSION
 export PROJECTS
 export REPODIR
 export WHEELHOUSE
-export OS_TEST_TIMEOUT=900
+export OS_TEST_TIMEOUT=1200
 cd $REPODIR/pbr
 mkvenv .venv
 source .venv/bin/activate
diff --git a/tox.ini b/tox.ini
index 7bc530a04442f6e245e9db212f12d41da6a5fedd..549dd4eda0dc01ab7a5f46b1a7e660754404e9fe 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -18,7 +18,7 @@ deps =
 commands = stestr run --suppress-attachments {posargs}
 
 [testenv:pep8]
-commands = flake8 {posargs}
+commands = pre-commit run -a
 
 [testenv:docs]
 whitelist_externals = rm
@@ -53,8 +53,3 @@ commands =
 ignore = W504
 exclude = .venv,.tox,dist,doc,*.egg,build
 show-source = true
-
-[testenv:lower-constraints]
-deps =
-  -c{toxinidir}/lower-constraints.txt
-  -r{toxinidir}/test-requirements.txt