summaryrefslogtreecommitdiff
path: root/pbr/packaging.py
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2015-07-16 12:34:50 +1200
committerRobert Collins <rbtcollins@hp.com>2015-07-29 06:19:40 +1200
commit89402a71776a02c69b67fc14452b82a9a9d85ac0 (patch)
tree57a9d404b042178052fa8d18de3762931c242e21 /pbr/packaging.py
parent1f102e60d72de4ece80c22c0be5734f74cc3b776 (diff)
downloadpbr-89402a71776a02c69b67fc14452b82a9a9d85ac0.tar.gz
Export ChangeLog and AUTHORS in install
readthedocs uses 'setup.py install' to prepare trees for doc creation, but ChangeLog is not currently created there, and doing so would be nice. This won't affect develop invocations AFAICT, and even if it did, the overheads are ~10% of the time to run 0 tests in Nova today - e.g. quite tolerable. Change-Id: I7bc18fc9ca2dbe852598cc79b2ad6273fc53557d
Diffstat (limited to 'pbr/packaging.py')
-rw-r--r--pbr/packaging.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py
index be5eb74..e444165 100644
--- a/pbr/packaging.py
+++ b/pbr/packaging.py
@@ -163,6 +163,20 @@ def parse_dependency_links(requirements_files=None):
return dependency_links
+class InstallWithGit(install.install):
+ """Extracts ChangeLog and AUTHORS from git then installs.
+
+ This is useful for e.g. readthedocs where the package is
+ installed and then docs built.
+ """
+
+ command_name = 'install'
+
+ def run(self):
+ _from_git(self.distribution)
+ return install.install.run(self)
+
+
class LocalInstall(install.install):
"""Runs python setup.py install in a sensible manner.
@@ -174,6 +188,7 @@ class LocalInstall(install.install):
command_name = 'install'
def run(self):
+ _from_git(self.distribution)
return du_install.install.run(self)
@@ -397,18 +412,22 @@ class LocalEggInfo(egg_info.egg_info):
self.filelist.append(entry)
+def _from_git(distribution):
+ option_dict = 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)
+
+
class LocalSDist(sdist.sdist):
"""Builds the ChangeLog and Authors files from VC first."""
command_name = 'sdist'
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)
+ _from_git(self.distribution)
# sdist.sdist is an old style class, can't use super()
sdist.sdist.run(self)