Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
a361ef49
Commit
a361ef49
authored
Nov 27, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract _use_header method
parent
fb2860e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
setuptools/command/easy_install.py
setuptools/command/easy_install.py
+16
-10
No files found.
setuptools/command/easy_install.py
View file @
a361ef49
...
...
@@ -20,6 +20,7 @@ from distutils.errors import DistutilsArgError, DistutilsOptionError, \
from
distutils.command.install
import
INSTALL_SCHEMES
,
SCHEME_KEYS
from
distutils
import
log
,
dir_util
from
distutils.command.build_scripts
import
first_line_re
from
distutils.spawn
import
find_executable
import
sys
import
os
import
zipimport
...
...
@@ -2126,8 +2127,8 @@ class WindowsScriptWriter(ScriptWriter):
blockers
=
[
name
+
x
for
x
in
old
]
yield
name
+
ext
,
header
+
script_text
,
't'
,
blockers
@
static
method
def
_adjust_header
(
type_
,
orig_header
):
@
class
method
def
_adjust_header
(
cls
,
type_
,
orig_header
):
"""
Make sure 'pythonw' is used for gui and and 'python' is used for
console (regardless of what sys.executable is).
...
...
@@ -2138,14 +2139,19 @@ class WindowsScriptWriter(ScriptWriter):
pattern
,
repl
=
repl
,
pattern
pattern_ob
=
re
.
compile
(
re
.
escape
(
pattern
),
re
.
IGNORECASE
)
new_header
=
pattern_ob
.
sub
(
string
=
orig_header
,
repl
=
repl
)
if
sys
.
platform
==
'win32'
:
from
distutils.spawn
import
find_executable
clean_header
=
new_header
[
2
:
-
1
].
strip
(
'"'
)
if
not
find_executable
(
clean_header
):
# the adjusted version doesn't exist, so return the original
return
orig_header
return
new_header
return
new_header
if
cls
.
_use_header
(
new_header
)
else
orig_header
@
staticmethod
def
_use_header
(
new_header
):
"""
Should _adjust_header use the replaced header?
On non-windows systems, always use. On
Windows systems, only use the replaced header if it resolves
to an executable on the system.
"""
clean_header
=
new_header
[
2
:
-
1
].
strip
(
'"'
)
return
sys
.
platform
!=
'win32'
or
find_executable
(
clean_header
)
class
WindowsExecutableLauncherWriter
(
WindowsScriptWriter
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment