[PATCH 4 of 6] mercurial: check mercurial/modulepolicy for modulepolicy

Yuya Nishihara yuya at tcha.org
Wed Mar 9 09:10:44 EST 2016


On Mon, 07 Mar 2016 23:33:22 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1452574998 0
> #      Tue Jan 12 05:03:18 2016 +0000
> # Node ID 6f8152b11dc36ea701c8a6a247cd3bbed4c53ca1
> # Parent  87c23b43ccb5387c236ea1624822dd54392bc73d
> mercurial: check mercurial/modulepolicy for modulepolicy
> 
> On local pure systems, setup doesn't rewrite mercurial/__init__.py,
> because the file is managed by Mercurial...
> 
> In order to let such systems work, we allow for a file:
> mercurial/modulepolicy to determine the policy.
> 
> A later patch will have setup.py write to this file.
> 
> diff --git a/mercurial/__init__.py b/mercurial/__init__.py
> --- a/mercurial/__init__.py
> +++ b/mercurial/__init__.py
> @@ -23,7 +23,15 @@
>  
>  # By default, require the C extensions for performance reasons.
>  if modulepolicy == '@' 'MODULELOADPOLICY' '@':
> -    modulepolicy = 'c'
> +    try:
> +        policyfile = os.path.join(os.path.dirname(__file__), 'modulepolicy')
> +        fp = open(policyfile, 'rb')
> +        r = fp.read()
> +        fp.close()
> +        if r:
> +            modulepolicy = r.split("\n")[0]
> +    except IOError:
> +        modulepolicy = 'c'

Looks like this isn't updated from V2.

http://patchwork.serpentine.com/patch/12675/


More information about the Mercurial-devel mailing list