Merge lp:~mpontillo/maas/git-bzr-doc-fix into lp:~maas-committers/maas/trunk

Proposed by Mike Pontillo
Status: Merged
Approved by: Mike Pontillo
Approved revision: no longer in the source branch.
Merged at revision: 3514
Proposed branch: lp:~mpontillo/maas/git-bzr-doc-fix
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 25 lines (+11/-4)
1 file modified
docs/conf.py (+11/-4)
To merge this branch: bzr merge lp:~mpontillo/maas/git-bzr-doc-fix
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+249843@code.launchpad.net

Commit message

Fake out bzr_* variables for git-based sandboxes when building docs, in order to allow git-based sandboxes to build the docs.

Description of the change

This change allows 'make doc' to work correctly in a git sandbox. (that is, a sandbox cloned using the 'git-bzr-ng' package)

When 'make doc' is run, the code shells out to run 'bzr' commands to determine the current revision, etc.

Since developing using git isn't officially supported, this is simply a hack to allow it the build to succeed.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Looks good! Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/conf.py'
2--- docs/conf.py 2014-10-16 01:50:05 +0000
3+++ docs/conf.py 2015-02-16 15:47:22 +0000
4@@ -284,10 +284,17 @@
5 intersphinx_mapping = {'http://docs.python.org/': None}
6
7 # Gather information about the branch and the build date.
8-from subprocess import check_output
9-bzr_last_revision_number = check_output(['bzr', 'revno'])
10-bzr_last_revision_date = check_output(['bzr', 'version-info', '--template={date}', '--custom'])
11-bzr_build_date = check_output(['bzr', 'version-info', '--template={build_date}', '--custom'])
12+from subprocess import check_output, CalledProcessError
13+try:
14+ bzr_last_revision_number = check_output(['bzr', 'revno'])
15+ bzr_last_revision_date = check_output(['bzr', 'version-info', '--template={date}', '--custom'])
16+ bzr_build_date = check_output(['bzr', 'version-info', '--template={build_date}', '--custom'])
17+except (CalledProcessError):
18+ # not a bzr repository
19+ bzr_last_revision_number = 'unknown'
20+ bzr_last_revision_date = check_output(['date', '-u', '+%Y-%m-%d %H:%M:%S %z'])
21+ bzr_build_date = bzr_last_revision_date
22+
23
24 # Populate html_context with the variables used in the templates.
25 html_context = {