Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
814b6c22
Kaydet (Commit)
814b6c22
authored
Nis 18, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revert r80166 (and r80171), restore Lib/platform.py. subprocess cannot be used in platform.py
üst
974eb5ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
platform.py
Lib/platform.py
+13
-15
No files found.
Lib/platform.py
Dosyayı görüntüle @
814b6c22
...
...
@@ -113,7 +113,7 @@ __copyright__ = """
__version__
=
'1.0.7'
import
sys
,
string
,
os
,
re
import
sys
,
string
,
os
,
re
### Globals & Constants
...
...
@@ -966,20 +966,13 @@ def _syscmd_file(target,default=''):
if
sys
.
platform
in
(
'dos'
,
'win32'
,
'win16'
,
'os2'
):
# XXX Others too ?
return
default
import
subprocess
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
]
rc
=
proc
.
wait
()
output
=
string
.
strip
(
f
.
read
())
rc
=
f
.
close
()
if
not
output
or
rc
:
return
default
else
:
...
...
@@ -995,6 +988,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
...
...
@@ -1029,11 +1024,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...
...
...
@@ -1045,6 +1040,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