Mercurial > hg
diff mercurial/__init__.py @ 28430:17b85d739b62
setup: create a module for the modulepolicy
Instead of rewriting __init__ to define the modulepolicy,
write out a __modulepolicy__.py file like __version__.py
This should work for both system-wide installation and in-place build. Therefore
we can avoid relying on two separate modulepolicy rules, '@MODULELOADPOLICY@'
and 'mercurial/modulepolicy'.
author | timeless <timeless@mozdev.org> |
---|---|
date | Wed, 09 Mar 2016 15:47:01 +0000 |
parents | 30a20167ae29 |
children | 859af6e78368 |
line wrap: on
line diff
--- a/mercurial/__init__.py Wed Mar 09 08:08:27 2016 -0800 +++ b/mercurial/__init__.py Wed Mar 09 15:47:01 2016 +0000 @@ -19,11 +19,14 @@ # c - require C extensions # allow - allow pure Python implementation when C loading fails # py - only load pure Python modules -modulepolicy = '@MODULELOADPOLICY@' - +# # By default, require the C extensions for performance reasons. -if modulepolicy == '@' 'MODULELOADPOLICY' '@': - modulepolicy = 'c' +modulepolicy = 'c' +try: + from . import __modulepolicy__ + modulepolicy = __modulepolicy__.modulepolicy +except ImportError: + pass # PyPy doesn't load C extensions. #