Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
69628b0a
Commit
69628b0a
authored
Aug 29, 1999
by
Greg Ward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch from Perry Stoll: support for Windows.
parent
1ea8af2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
Lib/distutils/spawn.py
Lib/distutils/spawn.py
+29
-10
No files found.
Lib/distutils/spawn.py
View file @
69628b0a
...
@@ -33,23 +33,42 @@ def spawn (cmd,
...
@@ -33,23 +33,42 @@ def spawn (cmd,
if
os
.
name
==
'posix'
:
if
os
.
name
==
'posix'
:
_spawn_posix
(
cmd
,
search_path
,
verbose
,
dry_run
)
_spawn_posix
(
cmd
,
search_path
,
verbose
,
dry_run
)
elif
os
.
name
==
'windows'
:
# ???
elif
os
.
name
in
(
'nt'
,
'windows'
):
# ???
# XXX should 'args' be cmd[1:] or cmd?
_spawn_nt
(
cmd
,
search_path
,
verbose
,
dry_run
)
# XXX how do we detect failure?
# XXX how to do this in pre-1.5.2?
# XXX is P_WAIT the correct mode?
# XXX how to make Windows search the path?
if
verbose
:
print
string
.
join
(
cmd
,
' '
)
if
not
dry_run
:
os
.
spawnv
(
os
.
P_WAIT
,
cmd
[
0
],
cmd
[
1
:])
else
:
else
:
raise
DistutilsPlatformError
,
\
raise
DistutilsPlatformError
,
\
"don't know how to spawn programs on platform '%s'"
%
os
.
name
"don't know how to spawn programs on platform '%s'"
%
os
.
name
# spawn ()
# spawn ()
def
_spawn_nt
(
cmd
,
search_path
=
1
,
verbose
=
0
,
dry_run
=
0
):
import
string
executable
=
cmd
[
0
]
if
search_path
:
paths
=
string
.
split
(
os
.
environ
[
'PATH'
],
os
.
pathsep
)
base
,
ext
=
os
.
path
.
splitext
(
executable
)
if
(
ext
!=
'.exe'
):
executable
=
executable
+
'.exe'
if
not
os
.
path
.
isfile
(
executable
):
paths
.
reverse
()
# go over the paths and keep the last one
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
executable
=
f
if
verbose
:
print
string
.
join
(
[
executable
]
+
cmd
[
1
:],
' '
)
if
not
dry_run
:
# spawn for NT requires a full path to the .exe
rc
=
os
.
spawnv
(
os
.
P_WAIT
,
executable
,
cmd
)
if
rc
!=
0
:
raise
DistutilsExecError
(
"command failed: %d"
%
rc
)
def
_spawn_posix
(
cmd
,
def
_spawn_posix
(
cmd
,
search_path
=
1
,
search_path
=
1
,
verbose
=
0
,
verbose
=
0
,
...
...
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