diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-05-24 10:16:20 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-05-24 10:16:20 -0400 |
commit | 2faf1e9a78136fe09365e8054f0fc04cdb26db94 (patch) | |
tree | 4db9fc083522503b96307ca44e3b3d811dfaabed /setuptools/command/easy_install.py | |
parent | efc915b3a20012ab7a6200b7b99fa970ea6dfbe4 (diff) | |
parent | cf2a28328628a15a95ec354f8c3a4421d3652e31 (diff) | |
download | external_python_setuptools-2faf1e9a78136fe09365e8054f0fc04cdb26db94.tar.gz external_python_setuptools-2faf1e9a78136fe09365e8054f0fc04cdb26db94.tar.bz2 external_python_setuptools-2faf1e9a78136fe09365e8054f0fc04cdb26db94.zip |
Merge changes from distribute 0.6.41
--HG--
rename : distribute_setup.py => ez_setup.py
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-x | setuptools/command/easy_install.py | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 146e1f47..c98be5a2 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1832,26 +1832,22 @@ def get_script_args(dist, executable=sys_executable, wininst=False): if sys.platform=='win32' or wininst: # On Windows/wininst, add a .py extension and an .exe launcher if group=='gui_scripts': - ext, launcher = '-script.pyw', 'gui.exe' + launcher_type = 'gui' + ext = '-script.pyw' old = ['.pyw'] new_header = re.sub('(?i)python.exe','pythonw.exe',header) else: - ext, launcher = '-script.py', 'cli.exe' + launcher_type = 'cli' + ext = '-script.py' old = ['.py','.pyc','.pyo'] new_header = re.sub('(?i)pythonw.exe','python.exe',header) - if platform.machine().lower()=='arm': - launcher = launcher.replace(".", "-arm.") - if is_64bit(): - launcher = launcher.replace(".", "-64.") - else: - launcher = launcher.replace(".", "-32.") if os.path.exists(new_header[2:-1].strip('"')) or sys.platform!='win32': hdr = new_header else: hdr = header yield (name+ext, hdr+script_text, 't', [name+x for x in old]) yield ( - name+'.exe', resource_string('setuptools', launcher), + name+'.exe', get_win_launcher(launcher_type), 'b' # write in binary mode ) if not is_64bit(): @@ -1867,6 +1863,23 @@ def get_script_args(dist, executable=sys_executable, wininst=False): # just write the stub with no extension. yield (name, header+script_text) +def get_win_launcher(type): + """ + Load the Windows launcher (executable) suitable for launching a script. + + `type` should be either 'cli' or 'gui' + + Returns the executable as a byte string. + """ + launcher_fn = '%s.exe' % type + if platform.machine().lower()=='arm': + launcher_fn = launcher_fn.replace(".", "-arm.") + if is_64bit(): + launcher_fn = launcher_fn.replace(".", "-64.") + else: + launcher_fn = launcher_fn.replace(".", "-32.") + return resource_string('setuptools', launcher_fn) + def load_launcher_manifest(name): manifest = pkg_resources.resource_string(__name__, 'launcher manifest.xml') if sys.version_info[0] < 3: |