def run(self): option_dict = self.distribution.get_option_dict('pbr') if git._git_is_installed(): git.write_git_changelog(option_dict=option_dict) git.generate_authors(option_dict=option_dict) tree_index = options.get_boolean_option(option_dict, 'autodoc_tree_index_modules', 'AUTODOC_TREE_INDEX_MODULES') auto_index = options.get_boolean_option(option_dict, 'autodoc_index_modules', 'AUTODOC_INDEX_MODULES') if not os.getenv('SPHINX_DEBUG'): # NOTE(afazekas): These options can be used together, # but they do a very similar thing in a different way if tree_index: self._sphinx_tree() if auto_index: self.generate_autoindex( set(option_dict.get( "autodoc_exclude_modules", [None, ""])[1].split())) # TODO(stephenfin): Deprecate this functionality once we depend on # Sphinx 1.6, which includes a similar feature, in g-r # https://github.com/sphinx-doc/sphinx/pull/3476 self.finalize_options() if hasattr(self, "builder_target_dirs"): # Sphinx >= 1.6.1 return setup_command.BuildDoc.run(self) # Sphinx < 1.6 for builder in self.builders: self.builder = builder self.finalize_options() self._sphinx_run()
def run(self): option_dict = self.distribution.get_option_dict('pbr') if git._git_is_installed(): git.write_git_changelog(option_dict=option_dict) git.generate_authors(option_dict=option_dict) tree_index = options.get_boolean_option(option_dict, 'autodoc_tree_index_modules', 'AUTODOC_TREE_INDEX_MODULES') auto_index = options.get_boolean_option(option_dict, 'autodoc_index_modules', 'AUTODOC_INDEX_MODULES') if not os.getenv('SPHINX_DEBUG'): # NOTE(afazekas): These options can be used together, # but they do a very similar thing in a different way if tree_index: self._sphinx_tree() if auto_index: self.generate_autoindex( set( option_dict.get("autodoc_exclude_modules", [None, ""])[1].split())) for builder in self.builders: self.builder = builder self.finalize_options() self.project = self.distribution.get_name() self.version = self.distribution.get_version() self.release = self.distribution.get_version() if options.get_boolean_option(option_dict, 'warnerrors', 'WARNERRORS'): self._sphinx_run() else: setup_command.BuildDoc.run(self)
def run(self): option_dict = self.distribution.get_option_dict('pbr') if git._git_is_installed(): git.write_git_changelog(option_dict=option_dict) git.generate_authors(option_dict=option_dict) tree_index = options.get_boolean_option(option_dict, 'autodoc_tree_index_modules', 'AUTODOC_TREE_INDEX_MODULES') auto_index = options.get_boolean_option(option_dict, 'autodoc_index_modules', 'AUTODOC_INDEX_MODULES') if not os.getenv('SPHINX_DEBUG'): # NOTE(afazekas): These options can be used together, # but they do a very similar thing in a different way if tree_index: self._sphinx_tree() if auto_index: self.generate_autoindex( set(option_dict.get( "autodoc_exclude_modules", [None, ""])[1].split())) for builder in self.builders: self.builder = builder self.finalize_options() self.project = self.distribution.get_name() self.version = self.distribution.get_version() self.release = self.distribution.get_version() if options.get_boolean_option(option_dict, 'warnerrors', 'WARNERRORS'): self._sphinx_run() else: setup_command.BuildDoc.run(self)
def _from_git(distribution): option_dict = distribution.get_option_dict('pbr') changelog = git._iter_log_oneline() if changelog: changelog = git._iter_changelog(changelog) git.write_git_changelog(option_dict=option_dict, changelog=changelog) git.generate_authors(option_dict=option_dict)
def test_write_git_changelog(self): self.useFixture(fixtures.FakePopen(lambda _: { "stdout": BytesIO(self.changelog.encode('utf-8')) })) git.write_git_changelog(git_dir=self.git_dir, dest_dir=self.temp_path) with open(os.path.join(self.temp_path, "ChangeLog"), "r") as ch_fh: changelog_contents = ch_fh.read() self.assertIn("2013.2", changelog_contents) self.assertIn("0.5.17", changelog_contents) self.assertIn("------", changelog_contents) self.assertIn("Refactor hooks file", changelog_contents) self.assertIn( "Bug fix: create\_stack() fails when waiting", changelog_contents) self.assertNotIn("Refactor hooks file.", changelog_contents) self.assertNotIn("182feb3", changelog_contents) self.assertNotIn("review/monty_taylor/27519", changelog_contents) self.assertNotIn("0.5.13", changelog_contents) self.assertNotIn("0.6.7", changelog_contents) self.assertNotIn("12", changelog_contents) self.assertNotIn("(evil)", changelog_contents) self.assertNotIn("ev()il", changelog_contents) self.assertNotIn("ev(il", changelog_contents) self.assertNotIn("ev)il", changelog_contents) self.assertNotIn("e(vi)l", changelog_contents) self.assertNotIn('Merge "', changelog_contents) self.assertNotIn('1\_foo.1', changelog_contents)
def test_write_git_changelog(self): self.useFixture(fixtures.FakePopen(lambda _: { "stdout": BytesIO(self.changelog.encode('utf-8')) })) git.write_git_changelog(git_dir=self.git_dir, dest_dir=self.temp_path) with open(os.path.join(self.temp_path, "ChangeLog"), "r") as ch_fh: changelog_contents = ch_fh.read() self.assertIn("2013.2", changelog_contents) self.assertIn("0.5.17", changelog_contents) self.assertIn("------", changelog_contents) self.assertIn("Refactor hooks file", changelog_contents) self.assertIn( "Bug fix: create_stack() fails when waiting", changelog_contents) self.assertNotIn("Refactor hooks file.", changelog_contents) self.assertNotIn("182feb3", changelog_contents) self.assertNotIn("review/monty_taylor/27519", changelog_contents) self.assertNotIn("0.5.13", changelog_contents) self.assertNotIn("0.6.7", changelog_contents) self.assertNotIn("12", changelog_contents) self.assertNotIn("(evil)", changelog_contents) self.assertNotIn("ev()il", changelog_contents) self.assertNotIn("ev(il", changelog_contents) self.assertNotIn("ev)il", changelog_contents) self.assertNotIn("e(vi)l", changelog_contents) self.assertNotIn('Merge "', changelog_contents) self.assertNotIn('1_foo.1', changelog_contents)
def run(self): option_dict = self.distribution.get_option_dict('pbr') changelog = git._iter_log_oneline(option_dict=option_dict) if changelog: changelog = git._iter_changelog(changelog) git.write_git_changelog(option_dict=option_dict, changelog=changelog) git.generate_authors(option_dict=option_dict) # sdist.sdist is an old style class, can't use super() sdist.sdist.run(self)
def run(self): option_dict = self.distribution.get_option_dict('pbr') if git._git_is_installed(): git.write_git_changelog(option_dict=option_dict) git.generate_authors(option_dict=option_dict) tree_index = options.get_boolean_option(option_dict, 'autodoc_tree_index_modules', 'AUTODOC_TREE_INDEX_MODULES') auto_index = options.get_boolean_option(option_dict, 'autodoc_index_modules', 'AUTODOC_INDEX_MODULES') if not os.getenv('SPHINX_DEBUG'): # NOTE(afazekas): These options can be used together, # but they do a very similar thing in a different way if tree_index: self._sphinx_tree() if auto_index: self.generate_autoindex( set(option_dict.get( "autodoc_exclude_modules", [None, ""])[1].split())) self.finalize_options() is_multibuilder_sphinx = version.SemanticVersion.from_pip_string( sphinx.__version__) >= version.SemanticVersion(1, 6) # TODO(stephenfin): Remove support for Sphinx < 1.6 in 4.0 if not is_multibuilder_sphinx: log.warn('[pbr] Support for Sphinx < 1.6 will be dropped in ' 'pbr 4.0. Upgrade to Sphinx 1.6+') # TODO(stephenfin): Remove this at the next MAJOR version bump if self.builders != ['html']: log.warn("[pbr] Sphinx 1.6 added native support for " "specifying multiple builders in the " "'[sphinx_build] builder' configuration option, " "found in 'setup.cfg'. As a result, the " "'[sphinx_build] builders' option has been " "deprecated and will be removed in pbr 4.0. Migrate " "to the 'builder' configuration option.") if is_multibuilder_sphinx: self.builder = self.builders if is_multibuilder_sphinx: # Sphinx >= 1.6 return setup_command.BuildDoc.run(self) # Sphinx < 1.6 for builder in self.builder: self.builder = builder self.finalize_options() self._sphinx_run()
def run(self): option_dict = self.distribution.get_option_dict('pbr') if git._git_is_installed(): git.write_git_changelog(option_dict=option_dict) git.generate_authors(option_dict=option_dict) tree_index = options.get_boolean_option(option_dict, 'autodoc_tree_index_modules', 'AUTODOC_TREE_INDEX_MODULES') auto_index = options.get_boolean_option(option_dict, 'autodoc_index_modules', 'AUTODOC_INDEX_MODULES') if not os.getenv('SPHINX_DEBUG'): # NOTE(afazekas): These options can be used together, # but they do a very similar thing in a different way if tree_index: self._sphinx_tree() if auto_index: self.generate_autoindex( set( option_dict.get("autodoc_exclude_modules", [None, ""])[1].split())) self.finalize_options() is_multibuilder_sphinx = version.SemanticVersion.from_pip_string( sphinx.__version__) >= version.SemanticVersion(1, 6) # TODO(stephenfin): Remove support for Sphinx < 1.6 in 4.0 if not is_multibuilder_sphinx: log.warning('[pbr] Support for Sphinx < 1.6 will be dropped in ' 'pbr 4.0. Upgrade to Sphinx 1.6+') # TODO(stephenfin): Remove this at the next MAJOR version bump if self.builders != ['html']: log.warning("[pbr] Sphinx 1.6 added native support for " "specifying multiple builders in the " "'[sphinx_build] builder' configuration option, " "found in 'setup.cfg'. As a result, the " "'[sphinx_build] builders' option has been " "deprecated and will be removed in pbr 4.0. Migrate " "to the 'builder' configuration option.") if is_multibuilder_sphinx: self.builder = self.builders if is_multibuilder_sphinx: # Sphinx >= 1.6 return setup_command.BuildDoc.run(self) # Sphinx < 1.6 for builder in self.builder: self.builder = builder self.finalize_options() self._sphinx_run()
def test_write_git_changelog(self): self.useFixture(fixtures.FakePopen(lambda _: { "stdout": BytesIO(_changelog_content.encode('utf-8')) })) git.write_git_changelog(git_dir=self.git_dir, dest_dir=self.temp_path) with open(os.path.join(self.temp_path, "ChangeLog"), "r") as ch_fh: changelog_contents = ch_fh.read() self.assertIn("2013.2", changelog_contents) self.assertIn("0.5.17", changelog_contents) self.assertIn("------", changelog_contents) self.assertIn("Refactor hooks file", changelog_contents) self.assertNotIn("Refactor hooks file.", changelog_contents) self.assertNotIn("182feb3", changelog_contents) self.assertNotIn("review/monty_taylor/27519", changelog_contents) self.assertNotIn("0.5.13", changelog_contents) self.assertNotIn('Merge "', changelog_contents)
def test_write_git_changelog(self): self.useFixture( fixtures.FakePopen( lambda _: {"stdout": BytesIO(_changelog_content.encode('utf-8'))})) git.write_git_changelog(git_dir=self.git_dir, dest_dir=self.temp_path) with open(os.path.join(self.temp_path, "ChangeLog"), "r") as ch_fh: changelog_contents = ch_fh.read() self.assertIn("2013.2", changelog_contents) self.assertIn("0.5.17", changelog_contents) self.assertIn("------", changelog_contents) self.assertIn("Refactor hooks file", changelog_contents) self.assertNotIn("Refactor hooks file.", changelog_contents) self.assertNotIn("182feb3", changelog_contents) self.assertNotIn("review/monty_taylor/27519", changelog_contents) self.assertNotIn("0.5.13", changelog_contents) self.assertNotIn('Merge "', changelog_contents)
def run(self): option_dict = self.distribution.get_option_dict('pbr') git.write_git_changelog(option_dict=option_dict) git.generate_authors(option_dict=option_dict) # sdist.sdist is an old style class, can't use super() sdist.sdist.run(self)
def pre_build_hook(self): git.write_git_changelog(self.git_dir, self.git_repo)
def run(self): option_dict = self.distribution.get_option_dict('pbr') # TODO(stephenfin): Remove this (and the entire file) when 5.0 is # released warn_opts = set(option_dict.keys()).intersection(_deprecated_options) warn_env = list(filter(lambda x: os.getenv(x), _deprecated_envs)) if warn_opts or warn_env: msg = ('The autodoc and autodoc_tree features are deprecated in ' '4.2 and will be removed in a future release. You should ' 'use the sphinxcontrib-apidoc Sphinx extension instead. ' 'Refer to the pbr documentation for more information.') if warn_opts: msg += ' Deprecated options: %s' % list(warn_opts) if warn_env: msg += ' Deprecated environment variables: %s' % warn_env log.warn(msg) if git._git_is_installed(): git.write_git_changelog(option_dict=option_dict) git.generate_authors(option_dict=option_dict) tree_index = options.get_boolean_option(option_dict, 'autodoc_tree_index_modules', 'AUTODOC_TREE_INDEX_MODULES') auto_index = options.get_boolean_option(option_dict, 'autodoc_index_modules', 'AUTODOC_INDEX_MODULES') if not os.getenv('SPHINX_DEBUG'): # NOTE(afazekas): These options can be used together, # but they do a very similar thing in a different way if tree_index: self._sphinx_tree() if auto_index: self.generate_autoindex( set(option_dict.get( "autodoc_exclude_modules", [None, ""])[1].split())) self.finalize_options() is_multibuilder_sphinx = version.SemanticVersion.from_pip_string( sphinx.__version__) >= version.SemanticVersion(1, 6) # TODO(stephenfin): Remove support for Sphinx < 1.6 in 4.0 if not is_multibuilder_sphinx: log.warn('[pbr] Support for Sphinx < 1.6 will be dropped in ' 'pbr 4.0. Upgrade to Sphinx 1.6+') # TODO(stephenfin): Remove this at the next MAJOR version bump if self.builders != ['html']: log.warn("[pbr] Sphinx 1.6 added native support for " "specifying multiple builders in the " "'[sphinx_build] builder' configuration option, " "found in 'setup.cfg'. As a result, the " "'[sphinx_build] builders' option has been " "deprecated and will be removed in pbr 4.0. Migrate " "to the 'builder' configuration option.") if is_multibuilder_sphinx: self.builder = self.builders if is_multibuilder_sphinx: # Sphinx >= 1.6 return setup_command.BuildDoc.run(self) # Sphinx < 1.6 for builder in self.builders: self.builder = builder self.finalize_options() self._sphinx_run()