summaryrefslogtreecommitdiffstats
path: root/docs/en
diff options
context:
space:
mode:
authorGervase Markham <gerv@gerv.net>2015-05-11 19:50:34 +0200
committerGervase Markham <gerv@gerv.net>2015-05-11 19:50:34 +0200
commitedef0e4ec2f63105d8971d89882ef513f5aed28a (patch)
tree8480cc61df04a1a625a1d257857ab7cc64614608 /docs/en
parentf805627ee9fcffba9f5a509bba652bfd663c6ae7 (diff)
downloadbugzilla-edef0e4ec2f63105d8971d89882ef513f5aed28a.tar.gz
bugzilla-edef0e4ec2f63105d8971d89882ef513f5aed28a.tar.xz
Bug 1144086 - Move extension docs assembly from makedocs.pl to conf.py. r=dkl,a=glob
Diffstat (limited to 'docs/en')
-rw-r--r--docs/en/rst/conf.py40
-rw-r--r--docs/en/rst/extensions/.gitignore6
2 files changed, 46 insertions, 0 deletions
diff --git a/docs/en/rst/conf.py b/docs/en/rst/conf.py
index b371d8393..c8be24e49 100644
--- a/docs/en/rst/conf.py
+++ b/docs/en/rst/conf.py
@@ -12,6 +12,8 @@
# serve to show the default.
import sys, os, re
+import os.path
+import shutil
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -384,3 +386,41 @@ pdf_fit_background_mode = 'scale'
todo_include_todos = True
extlinks = {'bug': ('https://bugzilla.mozilla.org/show_bug.cgi?id=%s', 'bug ')}
+
+# -- Assemble extension documentation ------------------------------------------
+
+# os.getcwd() is docs/$lang/rst
+lang = os.path.basename(os.path.dirname(os.getcwd()))
+
+# This is technically defined in Bugzilla/Constants.pm in Perl, but it's
+# unlikely to change if we use a relative path.
+ext_dir = "../../../extensions"
+
+# Still, check just in case, so if it ever changes, we know
+if (os.path.isdir(ext_dir)):
+ # Clear out old extensions docs
+ for dir in os.listdir("extensions"):
+ shutil.rmtree(os.path.join("extensions", dir))
+
+ # Copy in new copies
+ for ext_name in os.listdir(ext_dir):
+ ext_path = os.path.join(ext_dir, ext_name)
+ # Ignore files in the extensions/ directory (e.g. create.pl)
+ if not os.path.isdir(ext_path):
+ continue
+
+ # Ignore disabled extensions
+ if os.path.isfile(os.path.join(ext_path, "disabled")):
+ continue
+
+ src = os.path.join(ext_path, "docs", lang, "rst")
+
+ # Ignore extensions without rst docs in this language
+ if not os.path.isdir(src):
+ continue
+
+ dst = os.path.join("extensions", ext_name)
+
+ shutil.copytree(src, dst)
+else:
+ print "Warning: Bugzilla extension directory not found: " + ext_dir
diff --git a/docs/en/rst/extensions/.gitignore b/docs/en/rst/extensions/.gitignore
new file mode 100644
index 000000000..2bf521489
--- /dev/null
+++ b/docs/en/rst/extensions/.gitignore
@@ -0,0 +1,6 @@
+# Git doesn't like having empty directories in the repo.
+# So we have this file.
+# It says to ignore everything in this directory.
+*
+# Except this file, of course.
+!.gitignore