summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-04-15 14:11:09 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-04-15 14:11:09 -0400
commitc00eaad409e7b6465e6df579c5677824888861f8 (patch)
tree166220104c1d1e43aa47045c76c40421e9ec8e49 /setuptools/command
parent79257540df94ffb3ea7ed5b7e5d185b0432c3b44 (diff)
downloadpython-setuptools-bitbucket-c00eaad409e7b6465e6df579c5677824888861f8.tar.gz
Re-arrange _first_line_re to put core functionality at the top level
Diffstat (limited to 'setuptools/command')
-rwxr-xr-xsetuptools/command/easy_install.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 5206698f..de139f2f 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1530,11 +1530,15 @@ class PthDistributions(Environment):
def _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):
- return re.compile(first_line_re.pattern.decode())
+ """
+ Return a regular expression based on first_line_re suitable for matching
+ strings.
+ """
+ if isinstance(first_line_re.pattern, str):
+ return first_line_re
- return first_line_re
+ # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
+ return re.compile(first_line_re.pattern.decode())
def get_script_header(script_text, executable=sys_executable, wininst=False):