+A40351 <jalvarez@itri.org.tw>
Akihiro Motoki <motoki@da.jp.nec.com>
Alex Gaynor <alex.gaynor@gmail.com>
Alexander Makarov <amakarov@mirantis.com>
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>
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
-----
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
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
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
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
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
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'):
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]',
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)
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):
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(
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 = [
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