]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/lyxpreview_tools.py
lyxpreview: Allow to find python scripts.
[lyx.git] / lib / scripts / lyxpreview_tools.py
index 546ed24248aede74c992766bea14f7cac213e750..8408b3a08fd854219c06cf3605e66397cb3dacb4 100644 (file)
@@ -36,6 +36,7 @@ path = os.environ["PATH"].split(os.pathsep)
 extlist = ['']
 if "PATHEXT" in os.environ:
     extlist += os.environ["PATHEXT"].split(os.pathsep)
+extlist.append('.py')
 
 use_win32_modules = 0
 if os.name == "nt":
@@ -99,6 +100,9 @@ def find_exe(candidates):
                     # 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 command.replace(prog, '"%s" "%s"'
+                            % (sys.executable, full_path))
                     return command
 
     return None