Merge ~cjwatson/launchpad:apidoc-without-git into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 70b5f5e59d1dfb6373b85ae2b1f43702ee3616e6
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:apidoc-without-git
Merge into: launchpad:master
Diff against target: 34 lines (+3/-5)
1 file modified
utilities/create-lp-wadl-and-apidoc.py (+3/-5)
Reviewer Review Type Date Requested Status
Guruprasad Approve
Review via email: mp+442017@code.launchpad.net

Commit message

Make apidoc generation work outside a git working tree

Description of the change

Our machine-readable API documentation files are generated using the time of the last commit as their file modification times, in order that `ETag` headers are consistent. However, when building API documentation in a charmed deployment, we don't have a git working tree. Pick up the timestamp from `version-info.py` instead.

To post a comment you must log in.
Revision history for this message
Guruprasad (lgp171188) wrote :

LGTM ๐Ÿ‘๐Ÿผ

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/utilities/create-lp-wadl-and-apidoc.py b/utilities/create-lp-wadl-and-apidoc.py
2index 216db32..0192d3a 100755
3--- a/utilities/create-lp-wadl-and-apidoc.py
4+++ b/utilities/create-lp-wadl-and-apidoc.py
5@@ -15,8 +15,8 @@ import _pythonpath # noqa: F401
6
7 import optparse
8 import os
9-import subprocess
10 import sys
11+from datetime import datetime
12 from multiprocessing import Process
13
14 import six
15@@ -24,6 +24,7 @@ from lazr.restful.interfaces import IWebServiceConfiguration
16 from zope.component import getUtility
17 from zope.pagetemplate.pagetemplatefile import PageTemplateFile
18
19+from lp.app import versioninfo
20 from lp.services.scripts import execute_zcml_for_scripts
21 from lp.services.webservice.wadl import (
22 generate_html,
23@@ -140,10 +141,7 @@ def main(directory, force=False):
24 # generated files so that we can safely use it as part of Apache's etag
25 # generation in the face of multiple servers/filesystems.
26 timestamp = int(
27- subprocess.check_output(
28- ["git", "log", "-1", "--format=%ct", "HEAD"],
29- universal_newlines=True,
30- )
31+ datetime.strptime(versioninfo.date, "%Y-%m-%d %H:%M:%S %z").timestamp()
32 )
33
34 # Start a process to build each set of WADL and HTML files.

Subscribers

People subscribed via source and target branches

to status/vote changes: