[PATCH 2 of 2] run-tests: ensure install directories exist

Gregory Szorc gregory.szorc at gmail.com
Fri Feb 6 18:33:16 CST 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1423269185 28800
#      Fri Feb 06 16:33:05 2015 -0800
# Node ID 864fa617de1eb22fe20e81e4db5a28eb14a78163
# Parent  a758be135cf4455492970d4e8c0bc29b60562e41
run-tests: ensure install directories exist

As part of the transition to setuptools, it was discovered that
setuptools doesn't create install directories for you where distutils
apparently did. This was causing run-tests.py to fail when creating the
temporary hg install.

We work around this problem by creating the install directories before
running setup.py.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1862,8 +1862,19 @@ class TestRunner(object):
                   'base': os.path.join(self._hgtmp, "build"),
                   'prefix': self._installdir, 'libdir': self._pythondir,
                   'bindir': self._bindir,
                   'nohome': nohome, 'logfile': installerrs})
+
+        # setuptools requires install directories to exist.
+        def makedirs(p):
+            try:
+                os.makedirs(p)
+            except OSError as e:
+                if e.errno != errno.EEXIST:
+                    raise
+        makedirs(self._pythondir)
+        makedirs(self._bindir)
+
         vlog("# Running", cmd)
         if os.system(cmd) == 0:
             if not self.options.verbose:
                 os.remove(installerrs)


More information about the Mercurial-devel mailing list