[Python-checkins] devinabox: Code up more build rules for documentation.

brett.cannon python-checkins at python.org
Mon Feb 28 23:03:50 CET 2011


brett.cannon pushed fa02baedf1d6 to devinabox:

http://hg.python.org/devinabox/rev/fa02baedf1d6
changeset:   5:fa02baedf1d6
user:        Brett Cannon <brett at python.org>
date:        Fri Feb 25 17:08:51 2011 -0800
summary:
  Code up more build rules for documentation.

files:
  box.py

diff --git a/box.py b/box.py
--- a/box.py
+++ b/box.py
@@ -57,7 +57,8 @@
 
 """
 # XXX README or just the docstring for this script?
-# XXX Script to run thorough test suite?
+# XXX script to build CPython? multiprocessing.cpu_count(). Windows?
+# XXX script to run unit tests? multiprocessing.cpu_count()
 
 import abc
 import contextlib
@@ -237,7 +238,20 @@
     url = 'http://hg.python.org/devguide'
     directory = 'devguide'
 
-    # XXX build (and symlink the index); use Sphinx from docs
+    def build(self):
+        """Build the devguide and symlink its index page."""
+        # Grab Sphinx from cpython/Doc/tools/
+        tools_directory = os.path.join(CPython.directory, 'Doc', 'tools')
+        orig_pythonpath = os.environ['PYTHONPATH']
+        os.environ['PYTHONPATH'] = os.path.abspath(tools_directory)
+        try:
+            with change_cwd(self.directory):
+                subprocess.check_call(['make', 'html'])
+        finally:
+            os.environ['PYTHONPATH'] = orig_pythonpath
+        index_path = os.path.join(self.directory, '_build', 'html',
+                                  'index.html')
+        os.symlink(index_path, 'devguide.html')
 
 
 class PEPs(SvnProvider):
@@ -271,10 +285,9 @@
         with change_cwd(os.path.join(self.directory, 'Doc')):
             subprocess.check_call(['make', 'checkout'])
 
-    # XXX build docs (and symlink)
-    # XXX script to build CPython? multiprocessing.cpu_count(). Windows?
-    # XXX script to run unit tests? multiprocessing.cpu_count()
-
+    def build(self):
+        with change_cwd(os.path.join(self.directory, 'Doc'):
+                subprocess.check_call(['make', 'html'])
 
 
 if __name__ == '__main__':

--
Repository URL: http://hg.python.org/devinabox


More information about the Python-checkins mailing list