aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-04 21:53:03 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-04 21:53:03 -0500
commit126d971737a7b0fc89b0b84c2b48f6fd139df729 (patch)
tree04bde85683d18673b46badc36392c3f33eec3480 /setuptools/command/easy_install.py
parent254c2f03c69fd6ae34e70c1f89cb7ccbc4b5fed3 (diff)
downloadexternal_python_setuptools-126d971737a7b0fc89b0b84c2b48f6fd139df729.tar.gz
external_python_setuptools-126d971737a7b0fc89b0b84c2b48f6fd139df729.tar.bz2
external_python_setuptools-126d971737a7b0fc89b0b84c2b48f6fd139df729.zip
Use CommandSpec in ScriptWriter, removing now unused methods.
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py36
1 files changed, 3 insertions, 33 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index f075200c..7f8a9800 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -2014,39 +2014,9 @@ class ScriptWriter(object):
@classmethod
def get_header(cls, script_text="", executable=None):
"""Create a #! line, getting options (if any) from script_text"""
- executable = executable or nt_quote_arg(CommandSpec.launcher)
-
- options = cls._extract_options(script_text)
- options = cls._handle_non_ascii_exe(executable, options)
- tmpl = '#!{executable} {options}\n' if options else '#!{executable}\n'
-
- executable = fix_jython_executable(executable, options)
- return tmpl.format(**locals())
-
- @classmethod
- def _extract_options(cls, orig_script):
- """
- Extract any options from the first line of the script.
- """
- first = (orig_script + '\n').splitlines()[0]
- match = _first_line_re().match(first)
- options = match.group(1) or '' if match else ''
- return options.strip()
-
- @classmethod
- def _handle_non_ascii_exe(cls, executable, options):
- if isascii(executable):
- return options
-
- # Non-ascii path to sys.executable, use -x to prevent warnings
- if not options:
- return '-x'
-
- if not options.strip().startswith('-'):
- # punt, we can't do it, let the warning happen anyway
- return options
-
- return '-x' + options.strip()[1:]
+ cmd = CommandSpec.from_param(executable)
+ cmd.install_options(script_text)
+ return cmd.as_header()
class WindowsScriptWriter(ScriptWriter):