Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

docbook-manual-repo.py: follow PEP8 coding guidelines

  • Loading branch information...
commit f55eb0571f705d9d9cc6b9e31d627c38ad11a048 1 parent de0d852
Damien Regad dregad authored
Showing with 31 additions and 17 deletions.
  1. +31 −17 docbook-manual-repo.py
48 docbook-manual-repo.py
View
@@ -3,40 +3,47 @@
# Integrates with docbook-manual.py to build manuals for all tagged
# versions and development branches in the Git repo
-import os, sys
-from os import path
import getopt
+import os
+from os import path
import re
+import sys
# Absolute path to docbook-manual.py
manualscript = path.dirname(path.abspath(__file__)) + '/docbook-manual.py'
# Regular expressions of refs to ignore
ignorelist = map(re.compile, [
- 'HEAD',
- '->',
- '-1\.0\.[\w\d]+',
- '-1\.1\.[\w\d]+'
- ])
+ 'HEAD',
+ '->',
+ '-1\.0\.[\w\d]+',
+ '-1\.1\.[\w\d]+'
+])
# Script options
options = "hr:fda"
-long_options = [ "help", "ref=", "force", "delete", "all", "pdf", "html", "release" ]
+long_options = ["help", "ref=", "force", "delete",
+ "all", "pdf", "html", "release"]
+
def usage():
- print '''Usage: docbook-manual-repo /path/to/mantisbt/repo /path/to/install [<lang> ...]
+ print '''Usage: docbook-manual-repo /path/to/mantisbt/repo \
+/path/to/install [<lang> ...]
+
Options: -h | --help Print this usage message
-r | --ref Select what refs to build
-f | --force Ignore timestamps and force building
-d | --delete Delete install directories before building
--html Build HTML manual
--pdf Build PDF manual
- --release Build single file types used for release tarballs
+ --release Build single file types used for
+ release tarballs
-a | --all Build all manual types'''
#end usage()
-def ignore( ref ):
+
+def ignore(ref):
'''Decide which refs to ignore based on regexen listed in 'ignorelist'.
'''
@@ -47,6 +54,7 @@ def ignore( ref ):
return ignore
#end ignore()
+
def main():
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], options, long_options)
@@ -83,7 +91,7 @@ def main():
pass_opts += " --pdf"
elif opt == "--release":
- pass_opst += " --release"
+ pass_opts += " --release"
if len(args) < 2:
usage()
@@ -113,14 +121,15 @@ def main():
# Regex to strip 'origin/' from ref names
refnameregex = re.compile('(?:[a-zA-Z0-9-.]+/)?(.*)')
- # For each ref, checkout and call docbook-manual.py, tracking last build timestamp
- # to prevent building a manual if there have been no commits since last build
+ # For each ref, checkout and call docbook-manual.py, tracking last build
+ # timestamp to prevent building a manual if there have been no commits
+ # since last build
for ref in refs:
print "Generating documentation for '%s'" % ref
- manualpath = installroot.rstrip('/') + '/' + refnameregex.search( ref ).group(1)
+ manualpath = path.join(installroot, refnameregex.search(ref).group(1))
- os.system('git checkout -f %s'%(ref))
+ os.system('git checkout -f %s' % ref)
lastchange = os.popen('git log --pretty="format:%ct" -n1').read()
buildfile = path.join(manualpath, '.build')
@@ -131,7 +140,12 @@ def main():
f.close()
if lastchange > lastbuild or force:
- buildcommand = '%s %s %s %s %s'%(manualscript, pass_opts, path.abspath('docbook'), manualpath, ' '.join(languages))
+ buildcommand = '%s %s %s %s %s' % (
+ manualscript,
+ pass_opts,
+ path.abspath('docbook'),
+ manualpath, ' '.join(languages)
+ )
print "Calling: " + buildcommand
if(os.system(buildcommand)):
print 'here'
Please sign in to comment.
Something went wrong with that request. Please try again.