# HG changeset patch # User Augie Fackler # Date 1311628072 18000 # Node ID bcba68e81a81a0cbd8b34c32fbad2783716e8a73 # Parent 0b21ae0a23662d08a5b78220b62fc3acaac52c26 setup3k: use getattr instead of hasattr Note that hasattr is fixed on Python 3, so this is more about being concise and keeping check-code happy than actual correctness of code. diff -r 0b21ae0a2366 -r bcba68e81a81 contrib/setup3k.py --- a/contrib/setup3k.py Mon Jul 25 16:37:18 2011 -0500 +++ b/contrib/setup3k.py Mon Jul 25 16:07:52 2011 -0500 @@ -8,7 +8,7 @@ from lib2to3.refactor import get_fixers_from_package as getfixers import sys -if not hasattr(sys, 'version_info') or sys.version_info < (2, 4, 0, 'final'): +if getattr(sys, 'version_info', (0, 0, 0)) < (2, 4, 0, 'final'): raise SystemExit("Mercurial requires Python 2.4 or later.") if sys.version_info[0] >= 3: @@ -236,7 +236,7 @@ try: build_ext.build_extension(self, ext) except CCompilerError: - if not hasattr(ext, 'optional') or not ext.optional: + if getattr(ext, 'optional', False): raise log.warn("Failed to build optional extension '%s' (skipping)", ext.name)