summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/command/build.py2
-rw-r--r--Lib/distutils/sysconfig.py7
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/distutils/command/build.py b/Lib/distutils/command/build.py
index c6f52e6..a86df0b 100644
--- a/Lib/distutils/command/build.py
+++ b/Lib/distutils/command/build.py
@@ -116,7 +116,7 @@ class build(Command):
self.build_scripts = os.path.join(self.build_base,
'scripts-%d.%d' % sys.version_info[:2])
- if self.executable is None:
+ if self.executable is None and sys.executable:
self.executable = os.path.normpath(sys.executable)
if isinstance(self.parallel, str):
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index a349467..570a612 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -28,7 +28,12 @@ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
if "_PYTHON_PROJECT_BASE" in os.environ:
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
else:
- project_base = os.path.dirname(os.path.abspath(sys.executable))
+ if sys.executable:
+ project_base = os.path.dirname(os.path.abspath(sys.executable))
+ else:
+ # sys.executable can be empty if argv[0] has been changed and Python is
+ # unable to retrieve the real program name
+ project_base = os.getcwd()
# python_build: (Boolean) if true, we're either building Python or