Patchwork [6,of,6] setup: write mercurial/modulepolicy for pure installs

login
register
mail settings
Submitter timeless@mozdev.org
Date March 8, 2016, 5:33 a.m.
Message ID <7c21b7f1e2233ea8d88b.1457415204@waste.org>
Download mbox | patch
Permalink /patch/13669/
State Accepted
Headers show

Comments

timeless@mozdev.org - March 8, 2016, 5:33 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1452574025 0
#      Tue Jan 12 04:47:05 2016 +0000
# Node ID 7c21b7f1e2233ea8d88bcbba9dcee58de7f2e375
# Parent  e907f1a7b27764981a1858c2d32396f34230439d
setup: write mercurial/modulepolicy for pure installs


This file tells the Mercurial loader to use Python libraries,
which is what the user wanted when they ran setup --pure.
Augie Fackler - March 8, 2016, 7:06 p.m.
On Mon, Mar 07, 2016 at 11:33:24PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1452574025 0
> #      Tue Jan 12 04:47:05 2016 +0000
> # Node ID 7c21b7f1e2233ea8d88bcbba9dcee58de7f2e375
> # Parent  e907f1a7b27764981a1858c2d32396f34230439d
> setup: write mercurial/modulepolicy for pure installs

I've queued patches 2-6. I don't understand patch 1 enough, so I've
punted it to indygreg on irc.

>
>
> This file tells the Mercurial loader to use Python libraries,
> which is what the user wanted when they ran setup --pure.
>
> diff --git a/.hgignore b/.hgignore
> --- a/.hgignore
> +++ b/.hgignore
> @@ -58,6 +58,7 @@
>  mercurial/mpatch.py
>  mercurial/osutil.py
>  mercurial/parsers.py
> +mercurial/modulepolicy
>
>  syntax: regexp
>  ^\.pc/
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -64,7 +64,7 @@
>       rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
>       rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
>       if test -d .hg; then rm -f mercurial/__version__.py; fi
> -	rm -rf build mercurial/locale
> +	rm -rf build mercurial/locale mercurial/modulepolicy
>       $(MAKE) -C doc clean
>
>  install: install-bin install-doc
> diff --git a/setup.py b/setup.py
> --- a/setup.py
> +++ b/setup.py
> @@ -367,6 +367,10 @@
>                                            modulepolicy.encode(libdir_escape))
>                  with open(dst, 'wb') as fh:
>                      fh.write(content)
> +            else:
> +                policy = os.path.join(os.path.dirname(dst), 'modulepolicy')
> +                with open(policy, 'wb') as fh:
> +                    fh.write(modulepolicy)
>
>          return dst, copied
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -58,6 +58,7 @@ 
 mercurial/mpatch.py
 mercurial/osutil.py
 mercurial/parsers.py
+mercurial/modulepolicy
 
 syntax: regexp
 ^\.pc/
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -64,7 +64,7 @@ 
 	rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
 	rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
 	if test -d .hg; then rm -f mercurial/__version__.py; fi
-	rm -rf build mercurial/locale
+	rm -rf build mercurial/locale mercurial/modulepolicy
 	$(MAKE) -C doc clean
 
 install: install-bin install-doc
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -367,6 +367,10 @@ 
                                           modulepolicy.encode(libdir_escape))
                 with open(dst, 'wb') as fh:
                     fh.write(content)
+            else:
+                policy = os.path.join(os.path.dirname(dst), 'modulepolicy')
+                with open(policy, 'wb') as fh:
+                    fh.write(modulepolicy)
 
         return dst, copied