mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-13 17:02:12 -05:00
* Define __file__ during conf.py execution.
* Make staticpath relative to conf.py dir.
This commit is contained in:
1 parent
2f37a14939
commit
ae7273b9ae
3 files changed
+6
-5
No files matched your search
+2
-2
@@ -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
|
||||
# ---------------------
|
||||
|
||||
+2
-1
@@ -448,7 +448,8 @@ class StandaloneHTMLBuilder(Builder):
|
||||
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('.'):
|
||||
|
||||
+2
-2
@@ -68,11 +68,11 @@ class Config(object):
|
||||
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user