[PATCH 1 of 6] plan9: drop py26 hacks

Matt Harbison mharbison72 at gmail.com
Fri Jun 16 23:05:34 EDT 2017


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1497652923 14400
#      Fri Jun 16 18:42:03 2017 -0400
# Node ID 067742482ebea687d10f87d4139193961e293aa9
# Parent  a3a36bcf122e2ea4edbbe4ac44da59446cf0ee07
plan9: drop py26 hacks

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1033,28 +1033,20 @@
     except Exception:
         pass
     cmd = quotecommand(cmd)
-    if pycompat.sysplatform == 'plan9' and (sys.version_info[0] == 2
-                                    and sys.version_info[1] < 7):
-        # subprocess kludge to work around issues in half-baked Python
-        # ports, notably bichued/python:
-        if not cwd is None:
-            os.chdir(cwd)
-        rc = os.system(cmd)
+    env = shellenviron(environ)
+    if out is None or _isstdout(out):
+        rc = subprocess.call(cmd, shell=True, close_fds=closefds,
+                             env=env, cwd=cwd)
     else:
-        env = shellenviron(environ)
-        if out is None or _isstdout(out):
-            rc = subprocess.call(cmd, shell=True, close_fds=closefds,
-                                 env=env, cwd=cwd)
-        else:
-            proc = subprocess.Popen(cmd, shell=True, close_fds=closefds,
-                                    env=env, cwd=cwd, stdout=subprocess.PIPE,
-                                    stderr=subprocess.STDOUT)
-            for line in iter(proc.stdout.readline, ''):
-                out.write(line)
-            proc.wait()
-            rc = proc.returncode
-        if pycompat.sysplatform == 'OpenVMS' and rc & 1:
-            rc = 0
+        proc = subprocess.Popen(cmd, shell=True, close_fds=closefds,
+                                env=env, cwd=cwd, stdout=subprocess.PIPE,
+                                stderr=subprocess.STDOUT)
+        for line in iter(proc.stdout.readline, ''):
+            out.write(line)
+        proc.wait()
+        rc = proc.returncode
+    if pycompat.sysplatform == 'OpenVMS' and rc & 1:
+        rc = 0
     return rc
 
 def checksignature(func):
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -143,17 +143,10 @@
     py2exeloaded = False
 
 def runcmd(cmd, env):
-    if (sys.platform == 'plan9'
-       and (sys.version_info[0] == 2 and sys.version_info[1] < 7)):
-        # subprocess kludge to work around issues in half-baked Python
-        # ports, notably bichued/python:
-        _, out, err = os.popen3(cmd)
-        return str(out), str(err)
-    else:
-        p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-                             stderr=subprocess.PIPE, env=env)
-        out, err = p.communicate()
-        return out, err
+    p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE, env=env)
+    out, err = p.communicate()
+    return out, err
 
 def runhg(cmd, env):
     out, err = runcmd(cmd, env)


More information about the Mercurial-devel mailing list