aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-04-15 13:54:53 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-04-15 13:54:53 -0400
commitbdab866e5efd23d156b4f598f79baa2208f16157 (patch)
treeb105dc6c3351f00554b1b7dd61e9ae9da0b04e38 /setuptools/command/easy_install.py
parent57e567ec43dfa2c103ee1f99bca8628da091c9db (diff)
downloadexternal_python_setuptools-bdab866e5efd23d156b4f598f79baa2208f16157.tar.gz
external_python_setuptools-bdab866e5efd23d156b4f598f79baa2208f16157.tar.bz2
external_python_setuptools-bdab866e5efd23d156b4f598f79baa2208f16157.zip
Extract first_line_re function to encapsulate compatibility mechanism
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 4f497c3b..d947e548 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1526,16 +1526,21 @@ class PthDistributions(Environment):
else:
return path
-def get_script_header(script_text, executable=sys_executable, wininst=False):
- """Create a #! line, getting options (if any) from script_text"""
+
+def _first_line_re():
from distutils.command.build_scripts import first_line_re
# first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
if not isinstance(first_line_re.pattern, str):
- first_line_re = re.compile(first_line_re.pattern.decode())
+ return re.compile(first_line_re.pattern.decode())
+
+ return first_line_re
+
+def get_script_header(script_text, executable=sys_executable, wininst=False):
+ """Create a #! line, getting options (if any) from script_text"""
first = (script_text+'\n').splitlines()[0]
- match = first_line_re.match(first)
+ match = _first_line_re().match(first)
options = ''
if match:
options = match.group(1) or ''