lyxpreview: Allow to find python scripts.

In particular, lilypond-book is just a python script. On windows,
we need to call the python interpreter, using the full path to
the script while being wary of spaces in the path.
This commit is contained in:
Julien Rioux 2012-06-27 13:51:01 +02:00
parent 3e5c9e51de
commit 5e030858e6
2 changed files with 5 additions and 0 deletions

View File

@ -63,6 +63,7 @@ def find_exe(candidates, path):
extlist = ['']
if "PATHEXT" in os.environ:
extlist = extlist + os.environ["PATHEXT"].split(os.pathsep)
extlist.append('.py')
for prog in candidates:
for directory in path:
@ -73,6 +74,8 @@ def find_exe(candidates, path):
# have found it). Return just the basename to avoid
# problems when the path to the executable contains
# spaces.
if full_path.lower().endswith('.py'):
return '"%s" "%s"' % (sys.executable, full_path)
return os.path.basename(full_path)
return None

View File

@ -71,6 +71,8 @@ What's new
- Insets in a bibliography entry are shown as text in the citation dialog.
- Correctly detect python scripts required by the preview mechanism.
* DOCUMENTATION AND LOCALIZATION