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
42dd86b8
Kaydet (Commit)
42dd86b8
authored
May 11, 2007
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Deprecate os.popen* and popen2 module in favor of the subprocess module.
üst
82be218e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
30 deletions
+69
-30
os.py
Lib/os.py
+29
-9
pimp.py
Lib/plat-mac/pimp.py
+5
-4
popen2.py
Lib/popen2.py
+3
-0
test___all__.py
Lib/test/test___all__.py
+2
-0
test_bz2.py
Lib/test/test_bz2.py
+10
-8
test_cmd_line.py
Lib/test/test_cmd_line.py
+7
-6
test_popen2.py
Lib/test/test_popen2.py
+6
-0
NEWS
Misc/NEWS
+2
-0
msilib.py
Tools/msi/msilib.py
+5
-3
No files found.
Lib/os.py
Dosyayı görüntüle @
42dd86b8
...
...
@@ -666,9 +666,15 @@ if _exists("fork"):
is a string it will be passed to the shell (as with os.system()). If
'bufsize' is specified, it sets the buffer size for the I/O pipes. The
file objects (child_stdin, child_stdout) are returned."""
import
popen2
stdout
,
stdin
=
popen2
.
popen2
(
cmd
,
bufsize
)
return
stdin
,
stdout
import
warnings
msg
=
"os.popen2 is deprecated. Use the subprocess module."
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
import
subprocess
PIPE
=
subprocess
.
PIPE
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
bufsize
=
bufsize
,
stdin
=
PIPE
,
stdout
=
PIPE
,
close_fds
=
True
)
return
p
.
stdin
,
p
.
stdout
__all__
.
append
(
"popen2"
)
if
not
_exists
(
"popen3"
):
...
...
@@ -679,9 +685,16 @@ if _exists("fork"):
is a string it will be passed to the shell (as with os.system()). If
'bufsize' is specified, it sets the buffer size for the I/O pipes. The
file objects (child_stdin, child_stdout, child_stderr) are returned."""
import
popen2
stdout
,
stdin
,
stderr
=
popen2
.
popen3
(
cmd
,
bufsize
)
return
stdin
,
stdout
,
stderr
import
warnings
msg
=
"os.popen3 is deprecated. Use the subprocess module."
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
import
subprocess
PIPE
=
subprocess
.
PIPE
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
bufsize
=
bufsize
,
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
,
close_fds
=
True
)
return
p
.
stdin
,
p
.
stdout
,
p
.
stderr
__all__
.
append
(
"popen3"
)
if
not
_exists
(
"popen4"
):
...
...
@@ -692,9 +705,16 @@ if _exists("fork"):
is a string it will be passed to the shell (as with os.system()). If
'bufsize' is specified, it sets the buffer size for the I/O pipes. The
file objects (child_stdin, child_stdout_stderr) are returned."""
import
popen2
stdout
,
stdin
=
popen2
.
popen4
(
cmd
,
bufsize
)
return
stdin
,
stdout
import
warnings
msg
=
"os.popen4 is deprecated. Use the subprocess module."
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
import
subprocess
PIPE
=
subprocess
.
PIPE
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
bufsize
=
bufsize
,
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
subprocess
.
STDOUT
,
close_fds
=
True
)
return
p
.
stdin
,
p
.
stdout
__all__
.
append
(
"popen4"
)
import
copy_reg
as
_copy_reg
...
...
Lib/plat-mac/pimp.py
Dosyayı görüntüle @
42dd86b8
...
...
@@ -14,7 +14,7 @@ intention is that the end user will use this through a GUI.
"""
import
sys
import
os
import
popen2
import
subprocess
import
urllib
import
urllib2
import
urlparse
...
...
@@ -101,10 +101,11 @@ def _cmd(output, dir, *cmditems):
output
.
write
(
"+
%
s
\n
"
%
cmd
)
if
NO_EXECUTE
:
return
0
child
=
popen2
.
Popen4
(
cmd
)
child
.
tochild
.
close
()
child
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
child
.
stdin
.
close
()
while
1
:
line
=
child
.
fromchild
.
readline
()
line
=
child
.
stdout
.
readline
()
if
not
line
:
break
if
output
:
...
...
Lib/popen2.py
Dosyayı görüntüle @
42dd86b8
...
...
@@ -8,6 +8,9 @@ and popen3(cmd) which return two or three pipes to the spawned command.
import
os
import
sys
import
warnings
warnings
.
warn
(
"The popen2 module is deprecated. Use the subprocess module."
,
DeprecationWarning
,
stacklevel
=
2
)
__all__
=
[
"popen2"
,
"popen3"
,
"popen4"
]
...
...
Lib/test/test___all__.py
Dosyayı görüntüle @
42dd86b8
...
...
@@ -9,6 +9,8 @@ warnings.filterwarnings("ignore",
"<string>"
)
warnings
.
filterwarnings
(
"ignore"
,
"the sets module is deprecated"
,
DeprecationWarning
,
"<string>"
)
warnings
.
filterwarnings
(
"ignore"
,
".*popen2 module is deprecated.*"
,
DeprecationWarning
)
class
AllTest
(
unittest
.
TestCase
):
...
...
Lib/test/test_bz2.py
Dosyayı görüntüle @
42dd86b8
...
...
@@ -5,7 +5,7 @@ from test.test_support import TESTFN
import
unittest
from
cStringIO
import
StringIO
import
os
import
popen2
import
subprocess
import
sys
import
bz2
...
...
@@ -21,18 +21,20 @@ class BaseTest(unittest.TestCase):
if
has_cmdline_bunzip2
:
def
decompress
(
self
,
data
):
pop
=
popen2
.
Popen3
(
"bunzip2"
,
capturestderr
=
1
)
pop
.
tochild
.
write
(
data
)
pop
.
tochild
.
close
()
ret
=
pop
.
fromchild
.
read
()
pop
.
fromchild
.
close
()
pop
=
subprocess
.
Popen
(
"bunzip2"
,
shell
=
True
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
pop
.
stdin
.
write
(
data
)
pop
.
stdin
.
close
()
ret
=
pop
.
stdout
.
read
()
pop
.
stdout
.
close
()
if
pop
.
wait
()
!=
0
:
ret
=
bz2
.
decompress
(
data
)
return
ret
else
:
# popen2.Popen3 doesn't exist on Windows, and even if it did, bunzip2
# isn't available to run.
# bunzip2 isn't available to run on Windows.
def
decompress
(
self
,
data
):
return
bz2
.
decompress
(
data
)
...
...
Lib/test/test_cmd_line.py
Dosyayı görüntüle @
42dd86b8
import
test.test_support
,
unittest
import
sys
import
popen2
import
subprocess
class
CmdLineTest
(
unittest
.
TestCase
):
def
start_python
(
self
,
cmd_line
):
outfp
,
infp
=
popen2
.
popen4
(
'"
%
s"
%
s'
%
(
sys
.
executable
,
cmd_line
))
infp
.
close
()
data
=
outfp
.
read
()
outfp
.
close
()
cmd
=
'"
%
s"
%
s'
%
(
sys
.
executable
,
cmd_line
)
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
p
.
stdin
.
close
()
data
=
p
.
stdout
.
read
()
p
.
stdout
.
close
()
# try to cleanup the child so we don't appear to leak when running
# with regrtest -R. This should be a no-op on Windows.
popen2
.
_cleanup
()
subprocess
.
_cleanup
()
return
data
def
exit_code
(
self
,
*
args
):
...
...
Lib/test/test_popen2.py
Dosyayı görüntüle @
42dd86b8
#! /usr/bin/env python
"""Test script for popen2.py"""
import
warnings
warnings
.
filterwarnings
(
"ignore"
,
".*popen2 module is deprecated.*"
,
DeprecationWarning
)
warnings
.
filterwarnings
(
"ignore"
,
"os
\
.popen. is deprecated.*"
,
DeprecationWarning
)
import
os
import
sys
import
unittest
...
...
Misc/NEWS
Dosyayı görüntüle @
42dd86b8
...
...
@@ -207,6 +207,8 @@ Core and builtins
Library
-------
- The popen2 module and os.popen* are deprecated. Use the subprocess module.
- Added an optional credentials argument to SMTPHandler, for use with SMTP
servers which require authentication.
...
...
Tools/msi/msilib.py
Dosyayı görüntüle @
42dd86b8
...
...
@@ -5,7 +5,7 @@ import win32com.client.gencache
import
win32com.client
import
pythoncom
,
pywintypes
from
win32com.client
import
constants
import
re
,
string
,
os
,
sets
,
glob
,
popen2
,
sys
,
_winreg
,
struct
import
re
,
string
,
os
,
sets
,
glob
,
subprocess
,
sys
,
_winreg
,
struct
try
:
basestring
...
...
@@ -388,8 +388,10 @@ class CAB:
else
:
print
"WARNING: cabarc.exe not found in registry"
cabarc
=
"cabarc.exe"
f
=
popen2
.
popen4
(
r'"
%
s" -m lzx:21 n
%
s.cab @
%
s.txt'
%
(
cabarc
,
self
.
name
,
self
.
name
))[
0
]
for
line
in
f
:
cmd
=
r'"
%
s" -m lzx:21 n
%
s.cab @
%
s.txt'
%
(
cabarc
,
self
.
name
,
self
.
name
)
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)[
0
]
for
line
in
(
p
.
stdout
,
p
.
stdin
):
if
line
.
startswith
(
" -- adding "
):
sys
.
stdout
.
write
(
"."
)
else
:
...
...
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