comparison tests/hghave.py @ 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 9de689d20230
children 8bbe208c1812
comparison
equal deleted inserted replaced
19929:ab2362e1672e 19930:b8316878a685
274 def has_msys(): 274 def has_msys():
275 return os.getenv('MSYSTEM') 275 return os.getenv('MSYSTEM')
276 276
277 def has_aix(): 277 def has_aix():
278 return sys.platform.startswith("aix") 278 return sys.platform.startswith("aix")
279
280 def has_absimport():
281 import __future__
282 from mercurial import util
283 return util.safehasattr(__future__, "absolute_import")
279 284
280 checks = { 285 checks = {
281 "true": (lambda: True, "yak shaving"), 286 "true": (lambda: True, "yak shaving"),
282 "false": (lambda: False, "nail clipper"), 287 "false": (lambda: False, "nail clipper"),
283 "baz": (has_baz, "GNU Arch baz client"), 288 "baz": (has_baz, "GNU Arch baz client"),
316 "tla": (has_tla, "GNU Arch tla client"), 321 "tla": (has_tla, "GNU Arch tla client"),
317 "unix-permissions": (has_unix_permissions, "unix-style permissions"), 322 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
318 "windows": (has_windows, "Windows"), 323 "windows": (has_windows, "Windows"),
319 "msys": (has_msys, "Windows with MSYS"), 324 "msys": (has_msys, "Windows with MSYS"),
320 "aix": (has_aix, "AIX"), 325 "aix": (has_aix, "AIX"),
326 "absimport": (has_absimport, "absolute_import in __future__"),
321 } 327 }