changeset 19930:b8316878a685

hghave: add "absimport" feature to check "absolute_import" in __future__ This patch adds "absimport" feature to check whether "absolute_import" exists in __future__, which means supporting module loading by absolute name. This check is needed for portability of test code using "absolute_import", because Python earlier than 2.5 doesn't support it.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 05 Oct 2013 01:02:22 +0900
parents ab2362e1672e
children 8bbe208c1812
files tests/hghave.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Tue Oct 01 17:43:54 2013 -0700
+++ b/tests/hghave.py	Sat Oct 05 01:02:22 2013 +0900
@@ -277,6 +277,11 @@
 def has_aix():
     return sys.platform.startswith("aix")
 
+def has_absimport():
+    import __future__
+    from mercurial import util
+    return util.safehasattr(__future__, "absolute_import")
+
 checks = {
     "true": (lambda: True, "yak shaving"),
     "false": (lambda: False, "nail clipper"),
@@ -318,4 +323,5 @@
     "windows": (has_windows, "Windows"),
     "msys": (has_msys, "Windows with MSYS"),
     "aix": (has_aix, "AIX"),
+    "absimport": (has_absimport, "absolute_import in __future__"),
 }