run-tests: ensure install directories exist
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 06 Feb 2015 16:33:05 -0800
changeset 24075 4bf484276787
parent 24074 4d9c738d942f
child 24076 b53d2afd11fb
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.
tests/run-tests.py
--- a/tests/run-tests.py	Fri Feb 06 16:15:02 2015 -0800
+++ b/tests/run-tests.py	Fri Feb 06 16:33:05 2015 -0800
@@ -1863,6 +1863,17 @@
                   '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, 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: