diff options
-rwxr-xr-x | setuptools/command/easy_install.py | 10 | ||||
-rwxr-xr-x | setuptools/command/install_scripts.py | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 40504afc..c8ad0e50 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -9,7 +9,6 @@ file, or visit the `EasyInstall home page`__. __ http://peak.telecommunity.com/DevCenter/EasyInstall """ - import sys, os.path, zipimport, shutil, tempfile, zipfile, re, stat from glob import glob from setuptools import Command @@ -23,6 +22,7 @@ from setuptools.package_index import PackageIndex, parse_bdist_wininst from setuptools.package_index import URL_SCHEME from setuptools.command import bdist_egg, egg_info from pkg_resources import * +sys_executable = os.path.normpath(sys.executable) __all__ = [ 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', @@ -1118,7 +1118,7 @@ class PthDistributions(Environment): Environment.remove(self,dist) -def get_script_header(script_text): +def get_script_header(script_text, executable=sys_executable): """Create a #! line, getting options (if any) from script_text""" from distutils.command.build_scripts import first_line_re first, rest = (script_text+'\n').split('\n',1) @@ -1129,7 +1129,6 @@ def get_script_header(script_text): options = match.group(1) or '' if options: options = ' '+options - executable = os.path.normpath(sys.executable) return "#!%(executable)s%(options)s\n" % locals() def main(argv=None, **kw): @@ -1146,10 +1145,11 @@ def auto_chmod(func, arg, exc): exc = sys.exc_info() raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg))) -def get_script_args(dist): + +def get_script_args(dist, executable=sys_executable): """Yield write_script() argument tuples for a distribution's entrypoints""" spec = str(dist.as_requirement()) - header = get_script_header("") + header = get_script_header("", executable) for group in 'console_scripts', 'gui_scripts': for name,ep in dist.get_entry_map(group).items(): script_text = ( diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 601b66f3..66c08838 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -1,6 +1,6 @@ from distutils.command.install_scripts import install_scripts \ as _install_scripts -from easy_install import get_script_args +from easy_install import get_script_args, sys_executable from pkg_resources import Distribution, PathMetadata, ensure_directory import os from distutils import log @@ -19,12 +19,12 @@ class install_scripts(_install_scripts): ei_cmd.egg_base, PathMetadata(ei_cmd.egg_base, ei_cmd.egg_info), ei_cmd.egg_name, ei_cmd.egg_version, ) - for args in get_script_args(dist): - self.write_script(*args) + bs_cmd = self.get_finalized_command('build_scripts') + executable = getattr(bs_cmd,'executable',sys_executable) + for args in get_script_args(dist, executable): self.write_script(*args) def write_script(self, script_name, contents, mode="t", *ignored): """Write an executable file to the scripts directory""" - log.info("Installing %s script to %s", script_name, self.install_dir) target = os.path.join(self.install_dir, script_name) self.outfiles.append(target) |