FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Tools/c-analyzer/distutils/spawn.py at main · https-github-com-nzysoft/cpython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
https-github-com-nzysoft
/
cpython
Public
forked from
python/cpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Tools
/
c-analyzer
/
distutils
/
spawn.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (39 loc) · 1.47 KB
Breadcrumbs
cpython
/
Tools
/
c-analyzer
/
distutils
/
spawn.py
Copy path
File metadata and controls
48 lines (39 loc) · 1.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""distutils.spawn
Provides the 'spawn()' function, a front-end to various platform-
specific functions for launching another program in a sub-process.
Also provides the 'find_executable()' to search the path for a given
executable name.
"""
import
sys
import
os
import
os
.
path
def
find_executable
(
executable
,
path
=
None
):
"""Tries to find 'executable' in the directories listed in 'path'.
A string listing directories separated by 'os.pathsep'; defaults to
os.environ['PATH']. Returns the complete filename or None if not found.
"""
_
,
ext
=
os
.
path
.
splitext
(
executable
)
if
(
sys
.
platform
==
'win32'
)
and
(
ext
!=
'.exe'
):
executable
=
executable
+
'.exe'
if
os
.
path
.
isfile
(
executable
):
return
executable
if
path
is
None
:
path
=
os
.
environ
.
get
(
'PATH'
,
None
)
if
path
is
None
:
try
:
path
=
os
.
confstr
(
"CS_PATH"
)
except
(
AttributeError
,
ValueError
):
# os.confstr() or CS_PATH is not available
path
=
os
.
defpath
# bpo-35755: Don't use os.defpath if the PATH environment variable is
# set to an empty string
# PATH='' doesn't match, whereas PATH=':' looks in the current directory
if
not
path
:
return
None
paths
=
path
.
split
(
os
.
pathsep
)
for
p
in
paths
:
f
=
os
.
path
.
join
(
p
,
executable
)
if
os
.
path
.
isfile
(
f
):
# the file exists, we have a shot at spawn working
return
f
return
None
Back
|
FazBrowse Home
|
New Git URL