[Python-checkins] r61429 - in doctools/trunk: doc/conf.py sphinx/builder.py sphinx/config.py

georg.brandl python-checkins at python.org
Sun Mar 16 21:52:35 CET 2008


Author: georg.brandl
Date: Sun Mar 16 21:52:34 2008
New Revision: 61429

Modified:
   doctools/trunk/doc/conf.py
   doctools/trunk/sphinx/builder.py
   doctools/trunk/sphinx/config.py
Log:
* Define __file__ during conf.py execution.
* Make staticpath relative to conf.py dir.


Modified: doctools/trunk/doc/conf.py
==============================================================================
--- doctools/trunk/doc/conf.py	(original)
+++ doctools/trunk/doc/conf.py	Sun Mar 16 21:52:34 2008
@@ -11,10 +11,10 @@
 # All configuration values have a default value; values that are commented out
 # serve to show the default value.
 
-import sys
+import sys, os
 
 # If your extensions are in another directory, add it here.
-sys.path.append('.')
+sys.path.append(os.path.dirname(__file__))
 
 # General configuration
 # ---------------------

Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py	(original)
+++ doctools/trunk/sphinx/builder.py	Sun Mar 16 21:52:34 2008
@@ -448,7 +448,8 @@
         self.info(bold('copying static files...'))
         ensuredir(path.join(self.outdir, 'static'))
         staticdirnames = [path.join(path.dirname(__file__), 'static')] + \
-                         self.config.html_static_path
+                         [path.join(self.srcdir, spath)
+                          for spath in self.config.html_static_path]
         for staticdirname in staticdirnames:
             for filename in os.listdir(staticdirname):
                 if not filename.startswith('.'):

Modified: doctools/trunk/sphinx/config.py
==============================================================================
--- doctools/trunk/sphinx/config.py	(original)
+++ doctools/trunk/sphinx/config.py	Sun Mar 16 21:52:34 2008
@@ -68,11 +68,11 @@
 
     def __init__(self, dirname, filename):
         self.values = self.config_values.copy()
-        config = {}
+        config = {'__file__': path.join(dirname, filename)}
         olddir = os.getcwd()
         try:
             os.chdir(dirname)
-            execfile(path.join(dirname, filename), config)
+            execfile(config['__file__'], config)
         finally:
             os.chdir(olddir)
         # remove potentially pickling-problematic values


More information about the Python-checkins mailing list