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
b27ee20b
Commit
b27ee20b
authored
Apr 18, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert r80167, it breaks build on many platforms
parent
c45c3d99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
Lib/platform.py
Lib/platform.py
+13
-15
No files found.
Lib/platform.py
View file @
b27ee20b
...
...
@@ -111,7 +111,7 @@ __copyright__ = """
__version__
=
'1.0.7'
import
sys
,
os
,
re
,
subprocess
import
sys
,
os
,
re
### Globals & Constants
...
...
@@ -942,20 +942,13 @@ def _syscmd_file(target,default=''):
if
sys
.
platform
in
(
'dos'
,
'win32'
,
'win16'
,
'os2'
):
# XXX Others too ?
return
default
target
=
_follow_symlinks
(
target
)
target
=
_follow_symlinks
(
target
)
.
replace
(
'"'
,
'
\
\
"'
)
try
:
proc
=
subprocess
.
Popen
(
[
'file'
,
target
],
stdout
=
subprocess
.
PIPE
,
stderr
=
open
(
DEV_NULL
,
'wb'
))
f
=
os
.
popen
(
'file "%s" 2> %s'
%
(
target
,
DEV_NULL
))
except
(
AttributeError
,
os
.
error
):
return
default
stdout
,
stderr
=
proc
.
communicate
()
stdout
=
stdout
.
rstrip
(
b'
\
n
\
r
'
)
# get output from "filename: output"
output
=
stdout
.
split
(
b': '
,
1
)[
-
1
]
output
=
output
.
decode
(
'ASCII'
)
rc
=
proc
.
wait
()
output
=
f
.
read
().
strip
()
rc
=
f
.
close
()
if
not
output
or
rc
:
return
default
else
:
...
...
@@ -971,6 +964,8 @@ _default_architecture = {
'dos'
:
(
''
,
'MSDOS'
),
}
_architecture_split
=
re
.
compile
(
r'[\
s,]
').split
def architecture(executable=sys.executable,bits='',linkage=''):
""" Queries the given executable (defaults to the Python interpreter
...
...
@@ -1005,11 +1000,11 @@ def architecture(executable=sys.executable,bits='',linkage=''):
# Get data from the 'file' system command
if executable:
fileo
ut
=
_syscmd_file
(
executable
,
''
)
outp
ut = _syscmd_file(executable, '')
else:
fileo
ut
=
''
outp
ut = ''
if
not
fileo
ut
and
\
if not
outp
ut and
\
executable == sys.executable:
# "file" command did not return anything; we'll try to provide
# some sensible defaults then...
...
...
@@ -1021,6 +1016,9 @@ def architecture(executable=sys.executable,bits='',linkage=''):
linkage = l
return bits,linkage
# Split the output into a list of strings omitting the filename
fileout = _architecture_split(output)[1:]
if 'executable' not in fileout:
# Format not supported
return bits,linkage
...
...
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