[PATCH stable] setup: set SystemRoot even if .hg doesn't exist (issue3073)

Yuya Nishihara yuya at tcha.org
Sun Oct 30 13:18:15 UTC 2011


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1319980502 -32400
# Branch stable
# Node ID 4a702fd4fcf5f161af2ea49d543eb661add84a6f
# Parent  bf55991af17e7e07593cceb2163328ae8cf5ee65
setup: set SystemRoot even if .hg doesn't exist (issue3073)

It's necessary to run subprocess on Windows. Note that the original issue
was fixed by b357a972d6cd.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -134,6 +134,11 @@ def runhg(cmd, env):
 version = ''
 
 env = {'HGRCPATH': '', 'LANGUAGE': 'C'}
+if 'SystemRoot' in os.environ:
+    # Copy SystemRoot into the custom environment for Python 2.6
+    # under Windows. Otherwise, the subprocess will fail with
+    # error 0xc0150004. See: http://bugs.python.org/issue3440
+    env['SystemRoot'] = os.environ['SystemRoot']
 
 if os.path.isdir('.hg'):
     # Execute hg out of this directory with a custom environment which
@@ -143,11 +148,6 @@ if os.path.isdir('.hg'):
     env['PYTHONPATH'] = os.pathsep.join(pypath)
     if 'LD_LIBRARY_PATH' in os.environ:
         env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
-    if 'SystemRoot' in os.environ:
-        # Copy SystemRoot into the custom environment for Python 2.6
-        # under Windows. Otherwise, the subprocess will fail with
-        # error 0xc0150004. See: http://bugs.python.org/issue3440
-        env['SystemRoot'] = os.environ['SystemRoot']
     cmd = [sys.executable, 'hg', 'id', '-i', '-t']
     l = runhg(cmd, env).split()
     while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags



More information about the Mercurial-devel mailing list