@@ -25,7 +25,12 @@ |
|
|
25 |
25 |
# Path to the base directory of the project. On Windows the binary may |
26 |
26 |
# live in project/PCBuild9. If we're dealing with an x64 Windows build, |
27 |
27 |
# it'll live in project/PCbuild/amd64. |
28 |
|
-project_base = os.path.dirname(os.path.abspath(sys.executable)) |
|
28 |
+if sys.executable: |
|
29 |
+project_base = os.path.dirname(os.path.abspath(sys.executable)) |
|
30 |
+else: |
|
31 |
+# sys.executable can be empty if argv[0] has been changed and Python is |
|
32 |
+# unable to retrieve the real program name |
|
33 |
+project_base = os.getcwd() |
29 |
34 |
if os.name == "nt" and "pcbuild" in project_base[-8:].lower(): |
30 |
35 |
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir)) |
31 |
36 |
# PC/VS7.1 |
@@ -79,7 +84,12 @@ def get_python_inc(plat_specific=0, prefix=None): |
|
|
79 |
84 |
|
80 |
85 |
if os.name == "posix": |
81 |
86 |
if python_build: |
82 |
|
-buildir = os.path.dirname(sys.executable) |
|
87 |
+if sys.executable: |
|
88 |
+buildir = os.path.dirname(sys.executable) |
|
89 |
+else: |
|
90 |
+# sys.executable can be empty if argv[0] has been changed |
|
91 |
+# and Python is unable to retrieve the real program name |
|
92 |
+buildir = os.getcwd() |
83 |
93 |
if plat_specific: |
84 |
94 |
# python.h is located in the buildir |
85 |
95 |
inc_dir = buildir |