changeset 32291:a04f5c651e52

policy: relax the default for in-place build We're going to make the 'c' policy more strict, where no missing attribute will be allowed. Since we want to run 'hg bisect' without rebuilding the C extension modules, we'll need a looser policy for development environment. The default for system installation isn't changed. Note that the current 'c' policy is practically 'allow'-ish as we have lots of adhoc fallbacks to pure functions.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 26 Apr 2017 23:02:43 +0900
parents 8a137ef6e5da
children d67991c4fefe
files mercurial/policy.py setup.py
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/policy.py	Thu May 11 14:52:02 2017 -0700
+++ b/mercurial/policy.py	Wed Apr 26 23:02:43 2017 +0900
@@ -18,8 +18,10 @@
 #    cffi-allow - allow pure Python implementation if cffi version is missing
 #    py - only load pure Python modules
 #
-# By default, require the C extensions for performance reasons.
-policy = b'c'
+# By default, fall back to the pure modules so the in-place build can
+# run without recompiling the C extensions. This will be overridden by
+# __modulepolicy__ generated by setup.py.
+policy = b'allow'
 policynoc = (b'cffi', b'cffi-allow', b'py')
 policynocffi = (b'c', b'py')
 
--- a/setup.py	Thu May 11 14:52:02 2017 -0700
+++ b/setup.py	Wed Apr 26 23:02:43 2017 +0900
@@ -372,6 +372,9 @@
     def run(self):
         if self.distribution.pure:
             modulepolicy = 'py'
+        elif self.build_lib == '.':
+            # in-place build should run without rebuilding C extensions
+            modulepolicy = 'allow'
         else:
             modulepolicy = 'c'
         with open("mercurial/__modulepolicy__.py", "w") as f: