diff options
| author | Chris McDonough <chrism@plope.com> | 2011-12-09 04:18:16 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-12-09 04:18:16 -0500 |
| commit | 06f12ac4c5c2ae2027aac5bb873f7b01c4dee2e3 (patch) | |
| tree | 42acfa9ca9048b34520b64141a2d78af54fda8ef | |
| parent | ce61d63871e554e2ce97953915a5df0b935e16a3 (diff) | |
| download | pyramid-06f12ac4c5c2ae2027aac5bb873f7b01c4dee2e3.tar.gz pyramid-06f12ac4c5c2ae2027aac5bb873f7b01c4dee2e3.tar.bz2 pyramid-06f12ac4c5c2ae2027aac5bb873f7b01c4dee2e3.zip | |
try to protect against shell commands being invoked if imported during installation
| -rw-r--r-- | docs/conf.py | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/docs/conf.py b/docs/conf.py index 530703e14..e0954f19a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -39,20 +39,6 @@ LaTeXTranslator.depart_inline = nothing book = os.environ.get('BOOK') -# If your extensions are in another directory, add it here. If the directory -# is relative to the documentation root, use os.path.abspath to make it -# absolute, like shown here. -parent = os.path.dirname(os.path.dirname(__file__)) -sys.path.append(os.path.abspath(parent)) -wd = os.getcwd() -os.chdir(parent) -os.system('%s setup.py test -q' % sys.executable) -os.chdir(wd) - -for item in os.listdir(parent): - if item.endswith('.egg'): - sys.path.append(os.path.join(parent, item)) - # General configuration # --------------------- @@ -141,23 +127,36 @@ if book: # ----------------------- # Add and use Pylons theme -from subprocess import call, Popen, PIPE - -p = Popen('which git', shell=True, stdout=PIPE) -git = p.stdout.read().strip() -cwd = os.getcwd() -_themes = os.path.join(cwd, '_themes') - -if not os.path.isdir(_themes): - call([git, 'clone', 'git://github.com/Pylons/pylons_sphinx_theme.git', - '_themes']) -else: - os.chdir(_themes) - call([git, 'checkout', 'master']) - call([git, 'pull']) - os.chdir(cwd) - -sys.path.append(os.path.abspath('_themes')) +if 'sphinx-build' in ' '.join(sys.argv): # protect against dumb importers + from subprocess import call, Popen, PIPE + + p = Popen('which git', shell=True, stdout=PIPE) + git = p.stdout.read().strip() + cwd = os.getcwd() + _themes = os.path.join(cwd, '_themes') + + if not os.path.isdir(_themes): + call([git, 'clone', 'git://github.com/Pylons/pylons_sphinx_theme.git', + '_themes']) + else: + os.chdir(_themes) + call([git, 'checkout', 'master']) + call([git, 'pull']) + os.chdir(cwd) + + sys.path.append(os.path.abspath('_themes')) + + parent = os.path.dirname(os.path.dirname(__file__)) + sys.path.append(os.path.abspath(parent)) + wd = os.getcwd() + os.chdir(parent) + os.system('%s setup.py test -q' % sys.executable) + os.chdir(wd) + + for item in os.listdir(parent): + if item.endswith('.egg'): + sys.path.append(os.path.join(parent, item)) + html_theme_path = ['_themes'] html_theme = 'pyramid' html_theme_options = dict( |
