# HG changeset patch # User Augie Fackler # Date 2011-07-25 21:07:52 # 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 --git a/contrib/setup3k.py b/contrib/setup3k.py --- a/contrib/setup3k.py +++ b/contrib/setup3k.py @@ -8,7 +8,7 @@ from distutils.command.build_py import b 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 @@ class hgbuildext(build_ext): 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)