Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r71885:9c3738d44368
Date: 2014-06-02 15:53 -0700
http://bitbucket.org/pypy/pypy/changeset/9c3738d44368/

Log:    kill windows' popen funcs

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -21,9 +21,6 @@
     if os.name == 'nt':
         del appleveldefs['urandom'] # at interp on win32
         appleveldefs.update({
-            'popen2': 'app_posix.popen2',
-            'popen3': 'app_posix.popen3',
-            'popen4': 'app_posix.popen4',
             'startfile': 'app_startfile.startfile',
         })
 
diff --git a/pypy/module/posix/app_posix.py b/pypy/module/posix/app_posix.py
--- a/pypy/module/posix/app_posix.py
+++ b/pypy/module/posix/app_posix.py
@@ -122,86 +122,3 @@
                 return fd.read(n)
         except (OSError, IOError):
             raise NotImplementedError("/dev/urandom (or equivalent) not found")
-
-
-else:
-    # Windows implementations
-
-    def popen2(cmd, mode="t", bufsize=-1):
-        ""
-
-        cmd = _makecmd_string(cmd)
-
-        if mode not in ('b', 't'):
-            raise ValueError("invalid mode %r" % (mode,))
-
-        import subprocess
-        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
-                             stdin=subprocess.PIPE,
-                             stdout=subprocess.PIPE,
-                             universal_newlines=(mode =='t'))
-        return (_wrap_close(p.stdin, p), _wrap_close(p.stdout, p))
-
-    def popen3(cmd, mode="t", bufsize=-1):
-        ""
-
-        cmd = _makecmd_string(cmd)
-
-        if mode not in ('b', 't'):
-            raise ValueError("invalid mode %r" % (mode,))
-
-        import subprocess
-        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
-                             stdin=subprocess.PIPE,
-                             stdout=subprocess.PIPE,
-                             stderr=subprocess.PIPE,
-                             universal_newlines=(mode =='t'))
-        return (_wrap_close(p.stdin, p), _wrap_close(p.stdout, p),
-                _wrap_close(p.stderr, p))
-
-    def popen4(cmd, mode="t", bufsize=-1):
-        ""
-
-        cmd = _makecmd_string(cmd)
-
-        if mode not in ('b', 't'):
-            raise ValueError("invalid mode %r" % (mode,))
-
-        import subprocess
-        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
-                             stdin=subprocess.PIPE,
-                             stdout=subprocess.PIPE,
-                             stderr=subprocess.STDOUT,
-                             universal_newlines=(mode =='t'))
-        return (_wrap_close(p.stdin, p), _wrap_close(p.stdout, p))
-
-    # helper for making popen cmd a string object
-    def _makecmd_string(cmd):
-        if isinstance(cmd, unicode):
-            cmd = cmd.encode('ascii')
-
-        if not isinstance(cmd, str):
-            raise TypeError("invalid cmd type (%s, expected string)" %
-                            (type(cmd),))
-        return cmd
-
-    # A proxy for a file whose close waits for the process
-    class _wrap_close(object):
-        def __init__(self, stream, proc):
-            self._stream = stream
-            self._proc = proc
-        def close(self):
-            self._stream.close()
-            return self._proc.wait() or None    # 0 => None
-        __del__ = close
-
-        def __enter__(self):
-            return self
-
-        def __exit__(self, *k):
-            self.close()
-
-        def __getattr__(self, name):
-            return getattr(self._stream, name)
-        def __iter__(self):
-            return iter(self._stream)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to