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

login
register
mail settings
Submitter Gregory Szorc
Date Feb. 7, 2015, 12:33 a.m.
Message ID <864fa617de1eb22fe20e.1423269196@gps-mbp.local>
Download mbox | patch
Permalink /patch/7731/
State Accepted
Headers show

Comments

Gregory Szorc - Feb. 7, 2015, 12:33 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.
Augie Fackler - Feb. 8, 2015, 7:25 p.m.
On Fri, Feb 06, 2015 at 04:33:16PM -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1423269185 28800
> #      Fri Feb 06 16:33:05 2015 -0800
> # Node ID 864fa617de1eb22fe20e81e4db5a28eb14a78163
> # Parent  a758be135cf4455492970d4e8c0bc29b60562e41
> run-tests: ensure install directories exist

queued these two, thanks

>
> 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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

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)