[PATCH 1 of 3 V3] hghave: add "absimport" feature to check "absolute_import" in __future__
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Sat Sep 7 18:22:51 UTC 2013
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1378572147 -32400
# Sun Sep 08 01:42:27 2013 +0900
# Node ID 84e640cc281766ec91c9c2a3a264ccff3ba5010c
# Parent 1d07bf106c2ad1c7ef5e257e754ca8d858bd04b0
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.
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -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__"),
}
More information about the Mercurial-devel
mailing list