Anonymous avatar Anonymous committed 64abe20

* Define __file__ during conf.py execution.
* Make staticpath relative to conf.py dir.

Comments (0)

Files changed (3)

 # 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
 # ---------------------

sphinx/builder.py

         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('.'):
 
     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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.