From 0f0c892487277e25ce79a39477b193822f1edf79 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 15 Apr 2014 14:11:09 -0400 Subject: Re-arrange _first_line_re to put core functionality at the top level --- setuptools/command/easy_install.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'setuptools/command') 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): -- cgit v1.2.1