diff options
-rw-r--r-- | pbr/builddoc.py | 4 | ||||
-rw-r--r-- | pbr/packaging.py | 16 | ||||
-rw-r--r-- | pbr/tests/test_setup.py | 35 |
3 files changed, 39 insertions, 16 deletions
diff --git a/pbr/builddoc.py b/pbr/builddoc.py index f1822da..7c9916b 100644 --- a/pbr/builddoc.py +++ b/pbr/builddoc.py @@ -198,6 +198,10 @@ class LocalBuildDoc(setup_command.BuildDoc): def finalize_options(self): # Not a new style class, super keyword does not work. setup_command.BuildDoc.finalize_options(self) + # Handle builder option from command line - override cfg + option_dict = self.distribution.get_option_dict('build_sphinx') + if 'command line' in option_dict.get('builder', [[]])[0]: + self.builders = option_dict['builder'][1] # Allow builders to be configurable - as a comma separated list. if not isinstance(self.builders, list) and self.builders: self.builders = self.builders.split(',') diff --git a/pbr/packaging.py b/pbr/packaging.py index 9ed1dbb..4b47043 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -179,27 +179,11 @@ class LocalInstall(install.install): Force a non-egg installed in the manner of single-version-externally-managed, which allows us to install manpages and config files. - - Because non-egg installs bypass the depend processing machinery, we - need to do our own. Because easy_install is evil, just use pip to - process our requirements files directly, which means we don't have to - do crazy extra processing. - - Bypass installation if --single-version-externally-managed is given, - so that behavior for packagers remains the same. """ command_name = 'install' def run(self): - option_dict = self.distribution.get_option_dict('pbr') - if (not self.single_version_externally_managed - and self.distribution.install_requires): - _pip_install( - self.distribution.dependency_links, - self.distribution.install_requires, self.root, - option_dict=option_dict) - return du_install.install.run(self) diff --git a/pbr/tests/test_setup.py b/pbr/tests/test_setup.py index 9f66f7a..252658c 100644 --- a/pbr/tests/test_setup.py +++ b/pbr/tests/test_setup.py @@ -275,6 +275,41 @@ class BuildSphinxTest(base.BaseTestCase): self.assertIn('man', build_doc.builders) self.assertIn('doctest', build_doc.builders) + def test_cmd_builder_override(self): + + if self.has_opt: + self.distr.command_options["pbr"] = { + "autodoc_index_modules": ('setup.cfg', self.autodoc) + } + + self.distr.command_options["build_sphinx"]["builder"] = ( + "command line", "non-existing-builder") + + build_doc = packaging.LocalBuildDoc(self.distr) + self.assertNotIn('non-existing-builder', build_doc.builders) + self.assertIn('html', build_doc.builders) + + # process command line options which should override config + build_doc.finalize_options() + + self.assertIn('non-existing-builder', build_doc.builders) + self.assertNotIn('html', build_doc.builders) + + def test_cmd_builder_override_multiple_builders(self): + + if self.has_opt: + self.distr.command_options["pbr"] = { + "autodoc_index_modules": ('setup.cfg', self.autodoc) + } + + self.distr.command_options["build_sphinx"]["builder"] = ( + "command line", "builder1,builder2") + + build_doc = packaging.LocalBuildDoc(self.distr) + build_doc.finalize_options() + + self.assertEqual(["builder1", "builder2"], build_doc.builders) + class ParseRequirementsTest(base.BaseTestCase): |