Prepend pathex to the current PYTHONPATH before executing an external statement.

git-svn-id: http://svn.pyinstaller.org/trunk@850 8dd32b29-ccff-0310-8a9a-9233e24343b1
This commit is contained in:
lmancini
2010-06-15 12:44:40 +00:00
parent 5fb419a9b8
commit 20654e6a06
+15 -2
View File
@@ -17,7 +17,21 @@ def exec_statement(stat):
cmd = 'echo on && "%s" -c "%s" > "%s"' % (exe, stat, fnm)
else:
cmd = '"%s" -c "%s" > "%s"' % (exe, stat, fnm)
os.system(cmd)
# Prepend PYTHONPATH with pathex
pp = ':'.join(sys.pathex)
old_pp = os.environ.get('PYTHONPATH', '')
if old_pp:
pp = ':'.join([pp, old_pp])
os.environ["PYTHONPATH"] = pp
try:
# Actually execute the statement
os.system(cmd)
finally:
if old_pp:
os.environ["PYTHONPATH"] = old_pp
else:
del os.environ["PYTHONPATH"]
txt = open(fnm, 'r').read()[:-1]
os.remove(fnm)
@@ -74,4 +88,3 @@ def find_django_root(dir):
if "manage.py" in dir_entities and "settings.py" in dir_entities and "urls.py" in dir_entities:
django_root_directories.append(path_to_analyze)
return django_root_directories