Search the full path

master
Hans L 2012-03-13 22:39:56 -05:00
parent 6de282f4b7
commit 81c1b8a5e6
1 changed files with 9 additions and 9 deletions

View File

@ -7,18 +7,18 @@ from skeinforge_application.skeinforge_utilities import skeinforge_craft
def getPyPyExe(): def getPyPyExe():
"Return the path to the pypy executable if we can find it. Else return False" "Return the path to the pypy executable if we can find it. Else return False"
if platform.system() == "Windows": if platform.system() == "Windows":
exeName = "pypy.exe"
pypyExe = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../pypy/pypy.exe")); pypyExe = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../pypy/pypy.exe"));
else: else:
exeName = "pypy"
pypyExe = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../pypy/bin/pypy")); pypyExe = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../pypy/bin/pypy"));
if os.path.exists(pypyExe): if os.path.exists(pypyExe):
return pypyExe return pypyExe
pypyExe = "/bin/pypy";
if os.path.exists(pypyExe): path = os.environ['PATH']
return pypyExe paths = path.split(os.pathsep)
pypyExe = "/usr/bin/pypy"; for p in paths:
if os.path.exists(pypyExe): pypyExe = os.path.join(p, exeName)
return pypyExe
pypyExe = "/usr/local/bin/pypy";
if os.path.exists(pypyExe): if os.path.exists(pypyExe):
return pypyExe return pypyExe
return False return False