~abreu-alexandre/ubuntu-html5-theme/oxide-backport-14.04

« back to all changes in this revision

Viewing changes to 0.1/ambiance/js/docslib.py

  • Committer: CI bot
  • Author(s): Kyle Nitzsche
  • Date: 2014-04-04 14:11:26 UTC
  • mfrom: (153.1.5 ubuntu-html5-theme)
  • Revision ID: ps-jenkins@lists.canonical.com-20140404141126-k20bujy0hmwqsage
1) Fix lp bug https://bugs.launchpad.net/ubuntu-html5-theme/+bug/1241029

2) Improve doc building as follows:
  * add build script for docs: yuidoc-build.sh.(same as in unity-webapps-qml)
  * add docslib.py, used by yuidoc-build.sh to obtain bzr branch rev and
    insert it into yuidoc.json for use during build
  * add DOCSREADMET.txt: critical info about building docs
  * yuidoc.json: add majorversion field and set it to current framework: html-14.04-dev.
    The bzr branch rev is appended to this to create useful version field, which is consumed by yuidoc build and
    inserted into built html.

   As a result, the built index.html states the framework and the branch bzr rev as follows:
   "API Docs for: HTML-14.04-dev~bzr155" Fixes: 1287826

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python3
 
2
#
 
3
# Copyright 2014 Canonical Ltd
 
4
# Authors:
 
5
#   Kyle Nitzsche <kyle.nitzsche@canonical.com>
 
6
#
 
7
# This program is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation, version 3 of the License.
 
10
#
 
11
# This program is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program.  If not, see <http://www.gnu.org/licenses/
 
18
 
 
19
import json
 
20
import subprocess
 
21
import sys
 
22
 
 
23
jdata=open('yuidoc.json')
 
24
data=json.load(jdata)
 
25
majver=data['majorversion']
 
26
cmd="bzr version-info | grep revno | cut -f2 -d\ "
 
27
bzrrev=p = subprocess.Popen(cmd, shell=True, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()[0]
 
28
bzrrev = bzrrev.decode('utf-8')
 
29
bzrrev = bzrrev.rstrip()
 
30
data['version']=majver + '~bzr' + bzrrev
 
31
with open('yuidoc.json', 'w') as f:
 
32
   json.dump(data, f, ensure_ascii=False, indent=4)
 
33
exit(0)