Fix: on windows, make-mode didn't work on Win32 platform if sphinx was invoked as python sphinx-build.py.

This commit is contained in:
shimizukawa 2015-01-17 14:37:09 +09:00
parent 991d2455e8
commit e722258079
2 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,8 @@ Bugs fixed
* LaTeX writer now generates correct markup for cells spanning multiple rows.
* #1674: Do not crash if a module's ``__all__`` is not a list of strings.
* On windows, make-mode didn't work on Win32 platform if sphinx was invoked as
``python sphinx-build.py``.
Release 1.3b2 (released Dec 5, 2014)

View File

@ -251,13 +251,18 @@ class Make(object):
doctreedir = self.builddir_join('doctrees')
orig_cmd = sys.argv[0]
if orig_cmd.endswith('.exe'):
if sys.platform == 'win32' and orig_cmd.endswith('.exe'):
# win32: 'sphinx-build.exe'
cmd = [orig_cmd]
elif sys.platform == 'win32':
elif sys.platform == 'win32' and os.path.splitext(orig_cmd)[1] == '':
# win32: 'sphinx-build' without extension
cmd = [orig_cmd + '.exe']
else: # ex. 'sphinx-build' or 'sphinx-build.py'
else:
# win32: 'sphinx-build.py'
# linux, mac: 'sphinx-build' or 'sphinx-build.py'
cmd = [sys.executable, orig_cmd]
print(cmd)
return call(cmd + ['-b', builder] + opts +
['-d', doctreedir, self.srcdir, self.builddir_join(builder)])