Commit a78c722a authored by Jason R. Coombs's avatar Jason R. Coombs

Use a pattern object to invoke the substitution in _adjust_header, restoring...

Use a pattern object to invoke the substitution in _adjust_header, restoring Python 2.4-2.6 compatibility.

--HG--
extra : rebase_source : 4245d65731ca4433c80cf260906085500ab6c357
parent 6c256c76
......@@ -1862,8 +1862,8 @@ class WindowsScriptWriter(ScriptWriter):
repl = 'python.exe'
if type_ == 'gui':
pattern, repl = repl, pattern
new_header = re.sub(string=orig_header, pattern=re.escape(pattern),
repl=repl, flags=re.IGNORECASE)
pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
new_header = pattern_ob.sub(string=orig_header, repl=repl)
clean_header = new_header[2:-1].strip('"')
if sys.platform == 'win32' and not os.path.exists(clean_header):
# the adjusted version doesn't exist, so return the original
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment