Imported Upstream version 5.2.1 upstream/5.2.1
authorJinWang An <jinwang.an@samsung.com>
Mon, 28 Dec 2020 04:46:54 +0000 (13:46 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 28 Dec 2020 04:46:54 +0000 (13:46 +0900)
17 files changed:
.zuul.yaml
AUTHORS
ChangeLog
PKG-INFO
doc/requirements.txt
pbr.egg-info/PKG-INFO
pbr.egg-info/SOURCES.txt
pbr/cmd/main.py
pbr/hooks/files.py
pbr/tests/test_files.py
pbr/tests/test_util.py
pbr/util.py
playbooks/legacy/pbr-installation-devstack/run.yaml
playbooks/legacy/pbr-installation-upstream-devstack/run.yaml
releasenotes/notes/fix-handling-of-spaces-in-data-files-glob-0fe0c398d70dfea8.yaml [new file with mode: 0644]
test-requirements.txt
tox.ini

index 0f13f8365f31d623206557e99527ebc706d7f0a1..1244a2adfe6dd3a96985d7498fbb2500b717a5f3 100644 (file)
@@ -35,7 +35,6 @@
       - openstack/manila-ui
       - openstack/neutron
       - openstack/neutron-fwaas
-      - openstack/neutron-lbaas
       - openstack/neutron-vpnaas
       - openstack/nova
       - openstack/octavia
       - openstack-python-jobs
       - openstack-python35-jobs
       - openstack-python36-jobs
+      - openstack-python37-jobs
       - periodic-stable-jobs
       - publish-openstack-docs-pti
     check:
diff --git a/AUTHORS b/AUTHORS
index 9a3f12c08b97bbd5b50b3d96dee66a22aa134f36..5ba4f1f347afd2c0c412bfc46572895f3f46ba67 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,6 +22,7 @@ Christian Berendt <berendt@b1-systems.de>
 Chuck Short <chuck.short@canonical.com>
 Clark Boylan <clark.boylan@gmail.com>
 Claudiu Popa <cpopa@cloudbasesolutions.com>
+Corey Bryant <corey.bryant@canonical.com>
 Dan Prince <dprince@redhat.com>
 Darragh Bailey <dbailey@hp.com>
 Davanum Srinivas <dims@linux.vnet.ibm.com>
index 6355e667480113b868a925db91f9715823337e3e..3abcc13069f6b7e37e88c91a30855af00238f7de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 CHANGES
 =======
 
+5.2.1
+-----
+
+* Add openstack-tox-py37 job
+* Set subparser argument required
+* Remove neutron-lbaas
+* Update Sphinx requirement
+* Fix white space handling in file names
+
 5.2.0
 -----
 
index 47b4298ab3aabc440777e38e9e277a68990af67f..affac5941e74f6d18b0f62a2cbd56441b38dede6 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pbr
-Version: 5.2.0
+Version: 5.2.1
 Summary: Python Build Reasonableness
 Home-page: https://docs.openstack.org/pbr/latest/
 Author: OpenStack
index b9c5e1f17e9ba87751684d608e8801f010d0be1a..711fb9725295e7006043f3ad27c08913d3c3cc20 100644 (file)
@@ -1,3 +1,4 @@
-sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
+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
 openstackdocstheme>=1.18.1 # Apache-2.0
 reno>=2.5.0 # Apache-2.0
index 47b4298ab3aabc440777e38e9e277a68990af67f..affac5941e74f6d18b0f62a2cbd56441b38dede6 100644 (file)
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pbr
-Version: 5.2.0
+Version: 5.2.1
 Summary: Python Build Reasonableness
 Home-page: https://docs.openstack.org/pbr/latest/
 Author: OpenStack
index 8a3d98d2827673c32fe925d065e322d99ec4866c..2988e802980bba22cc63aefb85bca43492dbf5a3 100644 (file)
@@ -96,6 +96,7 @@ playbooks/legacy/pbr-installation-upstream-devstack/run.yaml
 releasenotes/notes/deprecate-pyN-requirements-364655c38fa5b780.yaml
 releasenotes/notes/deprecate-testr-nose-integration-56e3e11248d946fc.yaml
 releasenotes/notes/fix-global-replace-of-src-prefix-in-glob-eb850b94ca96993e.yaml
+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/ignore-find-links-07cf54f465aa33a6.yaml
index 29cd61d79149099802bed1684841ecd17ccb5bc0..91ea384eadc74342c1a7b9a2ea32035fda84a09c 100644 (file)
@@ -86,7 +86,9 @@ def main():
         version=str(pbr.version.VersionInfo('pbr')))
 
     subparsers = parser.add_subparsers(
-        title='commands', description='valid commands', help='additional help')
+        title='commands', description='valid commands', help='additional help',
+        dest='cmd')
+    subparsers.required = True
 
     cmd_sha = subparsers.add_parser('sha', help='print sha of package')
     cmd_sha.set_defaults(func=get_sha)
index 750ac32c642e8ce758345fc48adf32392c525574..0fe0df5522e8889b4a13cb9759b5705c54bfad3f 100644 (file)
@@ -14,6 +14,7 @@
 # under the License.
 
 import os
+import shlex
 import sys
 
 from pbr import find_package
@@ -35,6 +36,14 @@ def get_man_section(section):
     return os.path.join(get_manpath(), 'man%s' % section)
 
 
+def unquote_path(path):
+    # unquote the full path, e.g: "'a/full/path'" becomes "a/full/path", also
+    # strip the quotes off individual path components because os.walk cannot
+    # handle paths like: "'i like spaces'/'another dir'", so we will pass it
+    # "i like spaces/another dir" instead.
+    return "".join(shlex.split(path))
+
+
 class FilesConfig(base.BaseConfig):
 
     section = 'files'
@@ -57,25 +66,28 @@ class FilesConfig(base.BaseConfig):
                 target = target.strip()
                 if not target.endswith(os.path.sep):
                     target += os.path.sep
-                for (dirpath, dirnames, fnames) in os.walk(source_prefix):
+                unquoted_prefix = unquote_path(source_prefix)
+                unquoted_target = unquote_path(target)
+                for (dirpath, dirnames, fnames) in os.walk(unquoted_prefix):
                     # As source_prefix is always matched, using replace with a
                     # a limit of one is always going to replace the path prefix
                     # and not accidentally replace some text in the middle of
                     # the path
-                    new_prefix = dirpath.replace(source_prefix, target, 1)
-                    finished.append("%s = " % new_prefix)
+                    new_prefix = dirpath.replace(unquoted_prefix,
+                                                 unquoted_target, 1)
+                    finished.append("'%s' = " % new_prefix)
                     finished.extend(
-                        [" %s" % os.path.join(dirpath, f) for f in fnames])
+                        [" '%s'" % os.path.join(dirpath, f) for f in fnames])
             else:
                 finished.append(line)
 
         self.data_files = "\n".join(finished)
 
     def add_man_path(self, man_path):
-        self.data_files = "%s\n%s =" % (self.data_files, man_path)
+        self.data_files = "%s\n'%s' =" % (self.data_files, man_path)
 
     def add_man_page(self, man_page):
-        self.data_files = "%s\n  %s" % (self.data_files, man_page)
+        self.data_files = "%s\n  '%s'" % (self.data_files, man_page)
 
     def get_man_sections(self):
         man_sections = dict()
index ed67f7bc633c26caea66a2bbc672907700f4b661..94a2d9ad69027f4ea7b06dc827d997f4286c6a27 100644 (file)
@@ -37,12 +37,17 @@ class FilesConfigTest(base.BaseTestCase):
         pkg_etc = os.path.join(pkg_fixture.base, 'etc')
         pkg_ansible = os.path.join(pkg_fixture.base, 'ansible',
                                    'kolla-ansible', 'test')
+        dir_spcs = os.path.join(pkg_fixture.base, 'dir with space')
+        dir_subdir_spc = os.path.join(pkg_fixture.base, 'multi space',
+                                      'more spaces')
         pkg_sub = os.path.join(pkg_etc, 'sub')
         subpackage = os.path.join(
             pkg_fixture.base, 'fake_package', 'subpackage')
         os.makedirs(pkg_sub)
         os.makedirs(subpackage)
         os.makedirs(pkg_ansible)
+        os.makedirs(dir_spcs)
+        os.makedirs(dir_subdir_spc)
         with open(os.path.join(pkg_etc, "foo"), 'w') as foo_file:
             foo_file.write("Foo Data")
         with open(os.path.join(pkg_sub, "bar"), 'w') as foo_file:
@@ -51,6 +56,10 @@ class FilesConfigTest(base.BaseTestCase):
             baz_file.write("Baz Data")
         with open(os.path.join(subpackage, "__init__.py"), 'w') as foo_file:
             foo_file.write("# empty")
+        with open(os.path.join(dir_spcs, "file with spc"), 'w') as spc_file:
+            spc_file.write("# empty")
+        with open(os.path.join(dir_subdir_spc, "file with spc"), 'w') as file_:
+            file_.write("# empty")
 
         self.useFixture(base.DiveDir(pkg_fixture.base))
 
@@ -79,9 +88,49 @@ class FilesConfigTest(base.BaseTestCase):
         )
         files.FilesConfig(config, 'fake_package').run()
         self.assertIn(
-            '\netc/pbr/ = \n etc/foo\netc/pbr/sub = \n etc/sub/bar',
+            "\n'etc/pbr/' = \n 'etc/foo'\n'etc/pbr/sub' = \n 'etc/sub/bar'",
             config['files']['data_files'])
 
+    def test_data_files_with_spaces(self):
+        config = dict(
+            files=dict(
+                data_files="\n  'i like spaces' = 'dir with space'/*"
+            )
+        )
+        files.FilesConfig(config, 'fake_package').run()
+        self.assertIn(
+            "\n'i like spaces/' = \n 'dir with space/file with spc'",
+            config['files']['data_files'])
+
+    def test_data_files_with_spaces_subdirectories(self):
+        # test that we can handle whitespace in subdirectories
+        data_files = "\n 'one space/two space' = 'multi space/more spaces'/*"
+        expected = (
+            "\n'one space/two space/' = "
+            "\n 'multi space/more spaces/file with spc'")
+        config = dict(
+            files=dict(
+                data_files=data_files
+            )
+        )
+        files.FilesConfig(config, 'fake_package').run()
+        self.assertIn(expected, config['files']['data_files'])
+
+    def test_data_files_with_spaces_quoted_components(self):
+        # test that we can quote individual path components
+        data_files = (
+            "\n'one space'/'two space' = 'multi space'/'more spaces'/*"
+        )
+        expected = ("\n'one space/two space/' = "
+                    "\n 'multi space/more spaces/file with spc'")
+        config = dict(
+            files=dict(
+                data_files=data_files
+            )
+        )
+        files.FilesConfig(config, 'fake_package').run()
+        self.assertIn(expected, config['files']['data_files'])
+
     def test_data_files_globbing_source_prefix_in_directory_name(self):
         # We want to test that the string, "docs", is not replaced in a
         # subdirectory name, "sub-docs"
@@ -92,8 +141,8 @@ class FilesConfigTest(base.BaseTestCase):
         )
         files.FilesConfig(config, 'fake_package').run()
         self.assertIn(
-            '\nshare/ansible/ = '
-            '\nshare/ansible/kolla-ansible = '
-            '\nshare/ansible/kolla-ansible/test = '
-            '\n ansible/kolla-ansible/test/baz',
+            "\n'share/ansible/' = "
+            "\n'share/ansible/kolla-ansible' = "
+            "\n'share/ansible/kolla-ansible/test' = "
+            "\n 'ansible/kolla-ansible/test/baz'",
             config['files']['data_files'])
index 6814ac7b2c2bb31ce72213e26dba87d219ab6ecb..393bc5cd719b7d22810aaaf8930b6e836917d1d2 100644 (file)
@@ -172,3 +172,28 @@ class TestProvidesExtras(base.BaseTestCase):
         config = config_from_ini(ini)
         kwargs = util.setup_cfg_to_setup_kwargs(config)
         self.assertEqual(['foo', 'bar'], kwargs['provides_extras'])
+
+
+class TestDataFilesParsing(base.BaseTestCase):
+
+    scenarios = [
+        ('data_files', {
+            'config_text': """
+            [files]
+            data_files =
+                'i like spaces/' =
+                    'dir with space/file with spc 2'
+                    'dir with space/file with spc 1'
+            """,
+            'data_files': [
+                ('i like spaces/', ['dir with space/file with spc 2',
+                                    'dir with space/file with spc 1'])
+            ]
+        })]
+
+    def test_handling_of_whitespace_in_data_files(self):
+        config = config_from_ini(self.config_text)
+        kwargs = util.setup_cfg_to_setup_kwargs(config)
+
+        self.assertEqual(self.data_files,
+                         list(kwargs['data_files']))
index 55d73f8b4087bd928c4e1d28de744c267aadc995..e931b5ff0bc0aa2d74f94adbb106c07b84dd8f1a 100644 (file)
@@ -64,6 +64,7 @@ import logging  # noqa
 from collections import defaultdict
 import os
 import re
+import shlex
 import sys
 import traceback
 
@@ -372,21 +373,22 @@ def setup_cfg_to_setup_kwargs(config, script_args=()):
                 for line in in_cfg_value:
                     if '=' in line:
                         key, value = line.split('=', 1)
-                        key, value = (key.strip(), value.strip())
+                        key_unquoted = shlex.split(key.strip())[0]
+                        key, value = (key_unquoted, value.strip())
                         if key in data_files:
                             # Multiple duplicates of the same package name;
                             # this is for backwards compatibility of the old
                             # format prior to d2to1 0.2.6.
                             prev = data_files[key]
-                            prev.extend(value.split())
+                            prev.extend(shlex.split(value))
                         else:
-                            prev = data_files[key.strip()] = value.split()
+                            prev = data_files[key.strip()] = shlex.split(value)
                     elif firstline:
                         raise errors.DistutilsOptionError(
                             'malformed package_data first line %r (misses '
                             '"=")' % line)
                     else:
-                        prev.extend(line.strip().split())
+                        prev.extend(shlex.split(line.strip()))
                     firstline = False
                 if arg == 'data_files':
                     # the data_files value is a pointlessly different structure
index c3591cece552c1f8993982d83020434ecfa69c76..96f863adbb0d9cf88593f1f466d67a673244ba96 100644 (file)
@@ -63,7 +63,6 @@
           export PROJECTS="openstack/zaqar $PROJECTS"
           export PROJECTS="openstack/neutron $PROJECTS"
           export PROJECTS="openstack/neutron-fwaas $PROJECTS"
-          export PROJECTS="openstack/neutron-lbaas $PROJECTS"
           export PROJECTS="openstack/octavia $PROJECTS"
           export PROJECTS="openstack/neutron-vpnaas $PROJECTS"
           export PROJECTS="openstack/nova $PROJECTS"
index 554d44b2602cb995b03518c4402d3f8969ded9f2..544dd43b7734e484f5d3e7cd0a8e820a9d46572c 100644 (file)
@@ -63,7 +63,6 @@
           export PROJECTS="openstack/zaqar $PROJECTS"
           export PROJECTS="openstack/neutron $PROJECTS"
           export PROJECTS="openstack/neutron-fwaas $PROJECTS"
-          export PROJECTS="openstack/neutron-lbaas $PROJECTS"
           export PROJECTS="openstack/octavia $PROJECTS"
           export PROJECTS="openstack/neutron-vpnaas $PROJECTS"
           export PROJECTS="openstack/nova $PROJECTS"
diff --git a/releasenotes/notes/fix-handling-of-spaces-in-data-files-glob-0fe0c398d70dfea8.yaml b/releasenotes/notes/fix-handling-of-spaces-in-data-files-glob-0fe0c398d70dfea8.yaml
new file mode 100644 (file)
index 0000000..793ba73
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Fixes the handling of spaces in data_files globs. Please see `bug 1810934
+    <https://bugs.launchpad.net/pbr/+bug/1810934>`_ for more details.
index 70e4ca04aaf497c28ffe91e1552f33c89fe3c494..c30a2b1712d8689f8cbded8abad48d60d2289887 100644 (file)
@@ -14,5 +14,6 @@ virtualenv>=14.0.6 # MIT
 coverage!=4.4,>=4.0 # Apache-2.0
 
 # optionally exposed by distutils commands
-sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
+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
diff --git a/tox.ini b/tox.ini
index 4d460d8b765378cc9a81bf3b57b692695f996cd9..d029afcb3b6f8fe7e4b4a44dffd94a06155043fc 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,8 @@
 [tox]
-minversion = 2.0
-envlist = py{27,35,36},pep8,docs
+minversion = 3.1
+envlist = pep8,py{37,36,35,27},docs
+ignore_basepython_conflict = True
+skip_missing_interpreters = True
 
 [testenv]
 usedevelop = True