aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsetuptools/command/easy_install.py13
-rwxr-xr-xsetuptools/command/install_scripts.py12
2 files changed, 18 insertions, 7 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index bb0d8694..5667864b 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1862,6 +1862,19 @@ class CommandSpec(list):
launcher = os.environ.get('__PYVENV_LAUNCHER__', _default)
@classmethod
+ def from_param(cls, param):
+ """
+ Construct a CommandSpec from a parameter to build_scripts, which may
+ be None.
+ """
+ if isinstance(param, cls):
+ return param
+ if param is None:
+ return cls.from_environment()
+ # otherwise, assume it's a string.
+ return cls.from_string(param)
+
+ @classmethod
def from_environment(cls):
return cls.from_string(cls.launcher)
diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py
index 1717e1cf..722b0566 100755
--- a/setuptools/command/install_scripts.py
+++ b/setuptools/command/install_scripts.py
@@ -13,9 +13,8 @@ class install_scripts(orig.install_scripts):
self.no_ep = False
def run(self):
- from setuptools.command.easy_install import (
- ScriptWriter, sys_executable, nt_quote_arg,
- )
+ from setuptools.command.easy_install import ScriptWriter, CommandSpec
+
self.run_command("egg_info")
if self.distribution.scripts:
orig.install_scripts.run(self) # run first to set up self.outfiles
@@ -31,15 +30,14 @@ class install_scripts(orig.install_scripts):
ei_cmd.egg_name, ei_cmd.egg_version,
)
bs_cmd = self.get_finalized_command('build_scripts')
- executable = getattr(bs_cmd, 'executable', sys_executable)
+ cmd = CommandSpec.from_param(getattr(bs_cmd, 'executable', None))
is_wininst = getattr(
self.get_finalized_command("bdist_wininst"), '_is_running', False
)
if is_wininst:
- executable = "python.exe"
+ cmd = CommandSpec.from_string("python.exe")
writer = ScriptWriter.get_writer(force_windows=is_wininst)
- header = ScriptWriter.get_header("", nt_quote_arg(executable))
- for args in writer.get_args(dist, header):
+ for args in writer.get_args(dist, cmd.as_header()):
self.write_script(*args)
def write_script(self, script_name, contents, mode="t", *ignored):