[Python-checkins] r66919 - doctools/trunk/sphinx/builder.py

georg.brandl python-checkins at python.org
Thu Oct 16 21:29:35 CEST 2008


Author: georg.brandl
Date: Thu Oct 16 21:29:35 2008
New Revision: 66919

Log:
Create pygments.css before copying user-supplied static files.


Modified:
   doctools/trunk/sphinx/builder.py

Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py	(original)
+++ doctools/trunk/sphinx/builder.py	Thu Oct 16 21:29:35 2008
@@ -644,6 +644,18 @@
         # copy static files
         self.info(bold('copying static files... '), nonl=True)
         ensuredir(path.join(self.outdir, '_static'))
+        # first, create pygments style file
+        f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w')
+        f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet())
+        f.close()
+        # then, copy translations JavaScript file
+        if self.config.language is not None:
+            jsfile = path.join(path.dirname(__file__), 'locale', self.config.language,
+                               'LC_MESSAGES', 'sphinx.js')
+            if path.isfile(jsfile):
+                shutil.copyfile(jsfile, path.join(self.outdir, '_static',
+                                                  'translations.js'))
+        # then, copy over all user-supplied static files
         staticdirnames = [path.join(path.dirname(__file__), 'static')] + \
                          [path.join(self.confdir, spath)
                           for spath in self.config.html_static_path]
@@ -661,22 +673,11 @@
                     if path.exists(targetname):
                         shutil.rmtree(targetname)
                     shutil.copytree(fullname, targetname)
-        # add translations JavaScript file
-        if self.config.language is not None:
-            jsfile = path.join(path.dirname(__file__), 'locale', self.config.language,
-                               'LC_MESSAGES', 'sphinx.js')
-            if path.isfile(jsfile):
-                shutil.copyfile(jsfile, path.join(self.outdir, '_static',
-                                                  'translations.js'))
-        # copy logo file (handled differently)
+        # last, copy logo file (handled differently)
         if self.config.html_logo:
             logobase = path.basename(self.config.html_logo)
             shutil.copyfile(path.join(self.confdir, self.config.html_logo),
                             path.join(self.outdir, '_static', logobase))
-        # add pygments style file
-        f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w')
-        f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet())
-        f.close()
         self.info('done')
 
         # dump the search index


More information about the Python-checkins mailing list