[PATCH 5 of 7 v2] mercurial: check mercurial/modulepolicy for modulepolicy
Gregory Szorc
gregory.szorc at gmail.com
Tue Jan 12 17:58:43 CST 2016
On Mon, Jan 11, 2016 at 9:23 PM, timeless <timeless at mozdev.org> wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1452574998 0
> # Tue Jan 12 05:03:18 2016 +0000
> # Node ID 21b17c69ea254cceefc474baabedd5a777278c8c
> # Parent cffb330960bad95524d0d170fdc7aea009e5b01d
> 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()
>
This should be:
with open(policyfile, 'rb') as fh:
r = fp.read()
> + if r:
> + modulepolicy = r.split("\n")[0]
> + except IOError:
> + modulepolicy = 'c'
>
> # PyPy doesn't load C extensions.
> #
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20160112/4006bb2c/attachment.html>
More information about the Mercurial-devel
mailing list