Imported Upstream version 3.1.0 upstream/3.1.0
authorJinWang An <jinwang.an@samsung.com>
Mon, 28 Dec 2020 04:45:27 +0000 (13:45 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 28 Dec 2020 04:45:27 +0000 (13:45 +0900)
AUTHORS
ChangeLog
PKG-INFO
doc/source/index.rst
pbr.egg-info/PKG-INFO
pbr/builddoc.py
pbr/packaging.py
pbr/tests/test_packaging.py
pbr/tests/test_setup.py
test-requirements.txt

diff --git a/AUTHORS b/AUTHORS
index bbe67ad809195cec98d0cc82d580ddd3e3431513..faa64ef1b8d6f4c18ef784bf18538a139933705a 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,4 @@
+A40351 <jalvarez@itri.org.tw>
 Akihiro Motoki <motoki@da.jp.nec.com>
 Alex Gaynor <alex.gaynor@gmail.com>
 Alexander Makarov <amakarov@mirantis.com>
@@ -67,6 +68,7 @@ Mark Sienkiewicz <sienkiew@stsci.edu>
 Maru Newby <marun@redhat.com>
 Masaki Matsushita <glass.saga@gmail.com>
 Matt Riedemann <mriedem@us.ibm.com>
+Matthew Montgomery <matthew@signed8bit.com>
 Matthew Treinish <treinish@linux.vnet.ibm.com>
 Michael Basnight <mbasnight@gmail.com>
 Michael Still <mikal@stillhq.com>
index 4bc014435fa940d4c523c1acac8f5dde79ca33de..c34e8b536a6f39724eec1572cab1b3dae2317067 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 CHANGES
 =======
 
+3.1.0
+-----
+
+* allow user to override the output location of api docs
+* fix tests based on API change in Sphinx
+* Updated from global requirements
+* Add binding option for WSGI server
+* Ignore index URL lines in requirements.txt files
+
 3.0.1
 -----
 
index 3e4471a2f8c301e228abdc12106da65de45c222a..71b69fd44e5910231d9bb31c04aff32c92fd94c1 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pbr
-Version: 3.0.1
+Version: 3.1.0
 Summary: Python Build Reasonableness
 Home-page: http://docs.openstack.org/developer/pbr/
 Author: OpenStack
index 764edf1fb1cfbe0f027a0707515f255967f609d3..4ff2d7a835aa10ee872f95f129d5d55da25efab4 100644 (file)
@@ -321,6 +321,12 @@ The ``pbr`` section controls `pbr` specific options and behaviours.
   A list of modules to exclude when building module documentation using `pbr`.
   `fnmatch` style pattern (e.g. `myapp.tests.*`) can be used.
 
+``api_doc_dir``
+
+  A subdirectory inside the ``build_sphinx.source_dir`` where
+  auto-generated API documentation should be written, if
+  ``autodoc_index_modules`` is set to True. Defaults to ``"api"``.
+
 .. note::
 
    When using ``autodoc_tree_excludes`` or ``autodoc_index_modules`` you may
@@ -374,6 +380,11 @@ option.
       build-dir = doc/build
       all-files = 1
 
+``source_dir``
+
+  The path to the source directory where the Sphinx documentation tree
+  is.
+
 For information on the remaining options, refer to the `Sphinx
 documentation`__. In addition, the ``autodoc_index_modules``,
 ``autodoc_tree_index_modules``, ``autodoc_exclude_modules`` and
index 3e4471a2f8c301e228abdc12106da65de45c222a..71b69fd44e5910231d9bb31c04aff32c92fd94c1 100644 (file)
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pbr
-Version: 3.0.1
+Version: 3.1.0
 Summary: Python Build Reasonableness
 Home-page: http://docs.openstack.org/developer/pbr/
 Author: OpenStack
index 1d31502fee1884a230ff00cb28e10572a8524df8..c1a2e6f475304a997a1303bc7a1ad34c080397bb 100644 (file)
@@ -69,10 +69,13 @@ class LocalBuildDoc(setup_command.BuildDoc):
 
     def _get_source_dir(self):
         option_dict = self.distribution.get_option_dict('build_sphinx')
+        pbr_option_dict = self.distribution.get_option_dict('pbr')
+        _, api_doc_dir = pbr_option_dict.get('api_doc_dir', (None, 'api'))
         if 'source_dir' in option_dict:
-            source_dir = os.path.join(option_dict['source_dir'][1], 'api')
+            source_dir = os.path.join(option_dict['source_dir'][1],
+                                      api_doc_dir)
         else:
-            source_dir = 'doc/source/api'
+            source_dir = 'doc/source/' + api_doc_dir
         if not os.path.exists(source_dir):
             os.makedirs(source_dir)
         return source_dir
index a3527c91b08c51c7ac7a2142c08e00c90ccfd06c..913e7a3874c3cdd54f38c4ccad29748920fbb5c2 100644 (file)
@@ -102,6 +102,10 @@ def parse_requirements(requirements_files=None, strip_markers=False):
         if (not line.strip()) or line.startswith('#'):
             continue
 
+        # Ignore index URL lines
+        if re.match(r'^\s*(-i|--index-url|--extra-index-url).*', line):
+            continue
+
         # Handle nested requirements files such as:
         # -r other-requirements.txt
         if line.startswith('-r'):
@@ -282,12 +286,15 @@ if __name__ == "__main__":
     import wsgiref.simple_server as wss
 
     my_ip = socket.gethostbyname(socket.gethostname())
+
     parser = argparse.ArgumentParser(
         description=%(import_target)s.__doc__,
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
-        usage='%%(prog)s [-h] [--port PORT] -- [passed options]')
+        usage='%%(prog)s [-h] [--port PORT] [--host IP] -- [passed options]')
     parser.add_argument('--port', '-p', type=int, default=8000,
                         help='TCP port to listen on')
+    parser.add_argument('--host', '-b', default=my_ip,
+                        help='IP to bind the server to')
     parser.add_argument('args',
                         nargs=argparse.REMAINDER,
                         metavar='-- [passed options]',
@@ -301,11 +308,11 @@ if __name__ == "__main__":
         else:
             parser.error("unrecognized arguments: %%s" %% ' '.join(args.args))
     sys.argv[1:] = args.args
-    server = wss.make_server('', args.port, %(invoke_target)s())
+    server = wss.make_server(args.host, args.port, %(invoke_target)s())
 
     print("*" * 80)
     print("STARTING test server %(module_name)s.%(invoke_target)s")
-    url = "http://%%s:%%d/" %% (my_ip, server.server_port)
+    url = "http://%%s:%%d/" %% (server.server_name, server.server_port)
     print("Available at %%s" %% url)
     print("DANGER! For testing only, do not use in production")
     print("*" * 80)
index 69a8f7948f147091937c1469047659aedc38480c..9efcbd7892e1284e675d676edb856e336b2ac324 100644 (file)
@@ -486,6 +486,19 @@ class TestPresenceOfGit(base.BaseTestCase):
             self.assertEqual(False, git._git_is_installed())
 
 
+class TestIndexInRequirements(base.BaseTestCase):
+
+    def test_index_in_requirement(self):
+        tempdir = tempfile.mkdtemp()
+        requirements = os.path.join(tempdir, 'requirements.txt')
+        with open(requirements, 'w') as f:
+            f.write('-i https://myindex.local')
+            f.write('  --index-url https://myindex.local')
+            f.write(' --extra-index-url https://myindex.local')
+        result = packaging.parse_requirements([requirements])
+        self.assertEqual([], result)
+
+
 class TestNestedRequirements(base.BaseTestCase):
 
     def test_nested_requirement(self):
index 7aa74f63e2fd9ec2578f26037c4f4cb8ee1e1291..0b9c81be9c26d4ef0c1fe47339c4b8ad43772f98 100644 (file)
@@ -233,6 +233,14 @@ class BaseSphinxTest(base.BaseTestCase):
     def setUp(self):
         super(BaseSphinxTest, self).setUp()
 
+        # setup_command requires the Sphinx instance to have some
+        # attributes that aren't set normally with the way we use the
+        # class (because we replace the constructor). Add default
+        # values directly to the class definition.
+        import sphinx.application
+        sphinx.application.Sphinx.messagelog = []
+        sphinx.application.Sphinx.statuscode = 0
+
         self.useFixture(fixtures.MonkeyPatch(
             "sphinx.application.Sphinx.__init__", lambda *a, **kw: None))
         self.useFixture(fixtures.MonkeyPatch(
@@ -368,6 +376,78 @@ class BuildSphinxTest(BaseSphinxTest):
         self.assertEqual(["builder1", "builder2"], build_doc.builders)
 
 
+class APIAutoDocTest(base.BaseTestCase):
+
+    def setUp(self):
+        super(APIAutoDocTest, self).setUp()
+
+        # setup_command requires the Sphinx instance to have some
+        # attributes that aren't set normally with the way we use the
+        # class (because we replace the constructor). Add default
+        # values directly to the class definition.
+        import sphinx.application
+        sphinx.application.Sphinx.messagelog = []
+        sphinx.application.Sphinx.statuscode = 0
+
+        self.useFixture(fixtures.MonkeyPatch(
+            "sphinx.application.Sphinx.__init__", lambda *a, **kw: None))
+        self.useFixture(fixtures.MonkeyPatch(
+            "sphinx.application.Sphinx.build", lambda *a, **kw: None))
+        self.useFixture(fixtures.MonkeyPatch(
+            "sphinx.application.Sphinx.config", _SphinxConfig))
+        self.useFixture(fixtures.MonkeyPatch(
+            "sphinx.config.Config.init_values", lambda *a: None))
+        self.useFixture(fixtures.MonkeyPatch(
+            "sphinx.config.Config.__init__", lambda *a: None))
+        from distutils import dist
+        self.distr = dist.Distribution()
+        self.distr.packages = ("fake_package",)
+        self.distr.command_options["build_sphinx"] = {
+            "source_dir": ["a", "."]}
+        self.sphinx_options = self.distr.command_options["build_sphinx"]
+        pkg_fixture = fixtures.PythonPackage(
+            "fake_package", [("fake_module.py", b""),
+                             ("another_fake_module_for_testing.py", b""),
+                             ("fake_private_module.py", b"")])
+        self.useFixture(pkg_fixture)
+        self.useFixture(base.DiveDir(pkg_fixture.base))
+        self.pbr_options = self.distr.command_options.setdefault('pbr', {})
+        self.pbr_options["autodoc_index_modules"] = ('setup.cfg', 'True')
+
+    def test_default_api_build_dir(self):
+        build_doc = packaging.LocalBuildDoc(self.distr)
+        build_doc.run()
+
+        print('PBR OPTIONS:', self.pbr_options)
+        print('DISTR OPTIONS:', self.distr.command_options)
+
+        self.assertTrue(os.path.exists("api/autoindex.rst"))
+        self.assertTrue(os.path.exists("api/fake_package.fake_module.rst"))
+        self.assertTrue(
+            os.path.exists(
+                "api/fake_package.fake_private_module.rst"))
+        self.assertTrue(
+            os.path.exists(
+                "api/fake_package.another_fake_module_for_testing.rst"))
+
+    def test_different_api_build_dir(self):
+        # Options have to come out of the settings dict as a tuple
+        # showing the source and the value.
+        self.pbr_options['api_doc_dir'] = (None, 'contributor/api')
+        build_doc = packaging.LocalBuildDoc(self.distr)
+        build_doc.run()
+
+        print('PBR OPTIONS:', self.pbr_options)
+        print('DISTR OPTIONS:', self.distr.command_options)
+
+        self.assertTrue(os.path.exists("contributor/api/autoindex.rst"))
+        self.assertTrue(
+            os.path.exists("contributor/api/fake_package.fake_module.rst"))
+        self.assertTrue(
+            os.path.exists(
+                "contributor/api/fake_package.fake_private_module.rst"))
+
+
 class ParseRequirementsTestScenarios(base.BaseTestCase):
 
     versioned_scenarios = [
index c40f6e505eaf8ef812807434acbbf1069ec14615..9df6553a2b0cea70e4726773c489d9f1bd0bd667 100644 (file)
@@ -6,7 +6,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD
 hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
 mock>=2.0 # BSD
 python-subunit>=0.0.18 # Apache-2.0/BSD
-sphinx>=1.5.1 # BSD
+sphinx!=1.6.1,>=1.5.1 # BSD
 oslosphinx>=4.7.0 # Apache-2.0
 six>=1.9.0 # MIT
 testrepository>=0.0.18 # Apache-2.0/BSD