Submitter | timeless |
---|---|
Date | May 26, 2016, 2:25 a.m. |
Message ID | <94f71dd6051151a839d8.1464229549@gcc2-power8.osuosl.org> |
Download | mbox | patch |
Permalink | /patch/15208/ |
State | Accepted |
Headers | show |
Comments
On Thu, May 26, 2016 at 02:25:49AM +0000, timeless wrote: > # HG changeset patch > # User timeless <timeless@mozdev.org> > # Date 1457553345 0 > # Wed Mar 09 19:55:45 2016 +0000 > # Node ID 94f71dd6051151a839d8516e7f174757c10a3cf2 > # Parent fd288d118074ea8d7b4ddec10da6e75a71ba3312 > # EXP-Topic runtests > # Available At https://bitbucket.org/timeless/mercurial-crew > # hg pull https://bitbucket.org/timeless/mercurial-crew -r 94f71dd60511 > debuginstall: expose modulepolicy Queued this, seems generally useful. > > With this, you can check for pure easily: > $ HGMODULEPOLICY=py ./hg debuginstall -T "{hgmodulepolicy}" > py > > diff -r fd288d118074 -r 94f71dd60511 mercurial/__init__.py > --- a/mercurial/__init__.py Mon May 09 10:05:32 2016 +0200 > +++ b/mercurial/__init__.py Wed Mar 09 19:55:45 2016 +0000 > @@ -12,36 +12,13 @@ > import sys > import zipimport > > +from . import ( > + policy > +) > + > __all__ = [] > > -# Rules for how modules can be loaded. Values are: > -# > -# c - require C extensions > -# allow - allow pure Python implementation when C loading fails > -# py - only load pure Python modules > -# > -# By default, require the C extensions for performance reasons. > -modulepolicy = 'c' > -try: > - from . import __modulepolicy__ > - modulepolicy = __modulepolicy__.modulepolicy > -except ImportError: > - pass > - > -# PyPy doesn't load C extensions. > -# > -# The canonical way to do this is to test platform.python_implementation(). > -# But we don't import platform and don't bloat for it here. > -if '__pypy__' in sys.builtin_module_names: > - modulepolicy = 'py' > - > -# Our C extensions aren't yet compatible with Python 3. So use pure Python > -# on Python 3 for now. > -if sys.version_info[0] >= 3: > - modulepolicy = 'py' > - > -# Environment variable can always force settings. > -modulepolicy = os.environ.get('HGMODULEPOLICY', modulepolicy) > +modulepolicy = policy.policy > > # Modules that have both Python and C implementations. See also the > # set of .py files under mercurial/pure/. > diff -r fd288d118074 -r 94f71dd60511 mercurial/commands.py > --- a/mercurial/commands.py Mon May 09 10:05:32 2016 +0200 > +++ b/mercurial/commands.py Wed Mar 09 19:55:45 2016 +0000 > @@ -59,6 +59,7 @@ > obsolete, > patch, > phases, > + policy, > pvec, > repair, > revlog, > @@ -2748,6 +2749,8 @@ > '+'.join(hgver.split('+')[1:])) > > # compiled modules > + fm.write('hgmodulepolicy', _("checking module policy (%s)\n"), > + policy.policy) > fm.write('hgmodules', _("checking installed modules (%s)...\n"), > os.path.dirname(__file__)) > > diff -r fd288d118074 -r 94f71dd60511 mercurial/policy.py > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/mercurial/policy.py Wed Mar 09 19:55:45 2016 +0000 > @@ -0,0 +1,40 @@ > +# policy.py - module policy logic for Mercurial. > +# > +# Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com> > +# > +# This software may be used and distributed according to the terms of the > +# GNU General Public License version 2 or any later version. > + > +from __future__ import absolute_import > + > +import os > +import sys > + > +# Rules for how modules can be loaded. Values are: > +# > +# c - require C extensions > +# allow - allow pure Python implementation when C loading fails > +# py - only load pure Python modules > +# > +# By default, require the C extensions for performance reasons. > +policy = 'c' > +try: > + from . import __modulepolicy__ > + policy = __modulepolicy__.modulepolicy > +except ImportError: > + pass > + > +# PyPy doesn't load C extensions. > +# > +# The canonical way to do this is to test platform.python_implementation(). > +# But we don't import platform and don't bloat for it here. > +if '__pypy__' in sys.builtin_module_names: > + policy = 'py' > + > +# Our C extensions aren't yet compatible with Python 3. So use pure Python > +# on Python 3 for now. > +if sys.version_info[0] >= 3: > + policy = 'py' > + > +# Environment variable can always force settings. > +policy = os.environ.get('HGMODULEPOLICY', policy) > diff -r fd288d118074 -r 94f71dd60511 tests/test-install.t > --- a/tests/test-install.t Mon May 09 10:05:32 2016 +0200 > +++ b/tests/test-install.t Wed Mar 09 19:55:45 2016 +0000 > @@ -6,6 +6,7 @@ > checking Python lib (*lib*)... (glob) > checking Mercurial version (*) (glob) > checking Mercurial custom build (*) (glob) > + checking module policy (*) (glob) > checking installed modules (*mercurial)... (glob) > checking templates (*mercurial?templates)... (glob) > checking default template (*mercurial?templates?map-cmdline.default) (glob) > @@ -25,6 +26,7 @@ > "encoding": "ascii", > "encodingerror": null, > "extensionserror": null, > + "hgmodulepolicy": "*", (glob) > "hgmodules": "*mercurial", (glob) > "hgver": "*", (glob) > "hgverextra": "*", (glob) > @@ -47,6 +49,7 @@ > checking Python lib (*lib*)... (glob) > checking Mercurial version (*) (glob) > checking Mercurial custom build (*) (glob) > + checking module policy (*) (glob) > checking installed modules (*mercurial)... (glob) > checking templates (*mercurial?templates)... (glob) > checking default template (*mercurial?templates?map-cmdline.default) (glob) > @@ -70,6 +73,7 @@ > checking Python lib (*lib*)... (glob) > checking Mercurial version (*) (glob) > checking Mercurial custom build (*) (glob) > + checking module policy (*) (glob) > checking installed modules (*mercurial)... (glob) > checking templates (*mercurial?templates)... (glob) > checking default template (*mercurial?templates?map-cmdline.default) (glob) > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff -r fd288d118074 -r 94f71dd60511 mercurial/__init__.py --- a/mercurial/__init__.py Mon May 09 10:05:32 2016 +0200 +++ b/mercurial/__init__.py Wed Mar 09 19:55:45 2016 +0000 @@ -12,36 +12,13 @@ import sys import zipimport +from . import ( + policy +) + __all__ = [] -# Rules for how modules can be loaded. Values are: -# -# c - require C extensions -# allow - allow pure Python implementation when C loading fails -# py - only load pure Python modules -# -# By default, require the C extensions for performance reasons. -modulepolicy = 'c' -try: - from . import __modulepolicy__ - modulepolicy = __modulepolicy__.modulepolicy -except ImportError: - pass - -# PyPy doesn't load C extensions. -# -# The canonical way to do this is to test platform.python_implementation(). -# But we don't import platform and don't bloat for it here. -if '__pypy__' in sys.builtin_module_names: - modulepolicy = 'py' - -# Our C extensions aren't yet compatible with Python 3. So use pure Python -# on Python 3 for now. -if sys.version_info[0] >= 3: - modulepolicy = 'py' - -# Environment variable can always force settings. -modulepolicy = os.environ.get('HGMODULEPOLICY', modulepolicy) +modulepolicy = policy.policy # Modules that have both Python and C implementations. See also the # set of .py files under mercurial/pure/. diff -r fd288d118074 -r 94f71dd60511 mercurial/commands.py --- a/mercurial/commands.py Mon May 09 10:05:32 2016 +0200 +++ b/mercurial/commands.py Wed Mar 09 19:55:45 2016 +0000 @@ -59,6 +59,7 @@ obsolete, patch, phases, + policy, pvec, repair, revlog, @@ -2748,6 +2749,8 @@ '+'.join(hgver.split('+')[1:])) # compiled modules + fm.write('hgmodulepolicy', _("checking module policy (%s)\n"), + policy.policy) fm.write('hgmodules', _("checking installed modules (%s)...\n"), os.path.dirname(__file__)) diff -r fd288d118074 -r 94f71dd60511 mercurial/policy.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mercurial/policy.py Wed Mar 09 19:55:45 2016 +0000 @@ -0,0 +1,40 @@ +# policy.py - module policy logic for Mercurial. +# +# Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com> +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +from __future__ import absolute_import + +import os +import sys + +# Rules for how modules can be loaded. Values are: +# +# c - require C extensions +# allow - allow pure Python implementation when C loading fails +# py - only load pure Python modules +# +# By default, require the C extensions for performance reasons. +policy = 'c' +try: + from . import __modulepolicy__ + policy = __modulepolicy__.modulepolicy +except ImportError: + pass + +# PyPy doesn't load C extensions. +# +# The canonical way to do this is to test platform.python_implementation(). +# But we don't import platform and don't bloat for it here. +if '__pypy__' in sys.builtin_module_names: + policy = 'py' + +# Our C extensions aren't yet compatible with Python 3. So use pure Python +# on Python 3 for now. +if sys.version_info[0] >= 3: + policy = 'py' + +# Environment variable can always force settings. +policy = os.environ.get('HGMODULEPOLICY', policy) diff -r fd288d118074 -r 94f71dd60511 tests/test-install.t --- a/tests/test-install.t Mon May 09 10:05:32 2016 +0200 +++ b/tests/test-install.t Wed Mar 09 19:55:45 2016 +0000 @@ -6,6 +6,7 @@ checking Python lib (*lib*)... (glob) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) + checking module policy (*) (glob) checking installed modules (*mercurial)... (glob) checking templates (*mercurial?templates)... (glob) checking default template (*mercurial?templates?map-cmdline.default) (glob) @@ -25,6 +26,7 @@ "encoding": "ascii", "encodingerror": null, "extensionserror": null, + "hgmodulepolicy": "*", (glob) "hgmodules": "*mercurial", (glob) "hgver": "*", (glob) "hgverextra": "*", (glob) @@ -47,6 +49,7 @@ checking Python lib (*lib*)... (glob) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) + checking module policy (*) (glob) checking installed modules (*mercurial)... (glob) checking templates (*mercurial?templates)... (glob) checking default template (*mercurial?templates?map-cmdline.default) (glob) @@ -70,6 +73,7 @@ checking Python lib (*lib*)... (glob) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) + checking module policy (*) (glob) checking installed modules (*mercurial)... (glob) checking templates (*mercurial?templates)... (glob) checking default template (*mercurial?templates?map-cmdline.default) (glob)