summaryrefslogtreecommitdiff
path: root/contrib/setup3k.py
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2011-10-01 20:49:36 +0000
committerLorry <lorry@roadtrain.codethink.co.uk>2012-09-27 13:27:51 +0000
commit921ced43c48c1d170452a7b251b94cc96ec8dd44 (patch)
tree3c4a89176ea67fe4c7bf7b375488361a823c95fa /contrib/setup3k.py
parent9039c805b0a7e36220101323f82735f08a104b37 (diff)
downloadmercurial-tarball-921ced43c48c1d170452a7b251b94cc96ec8dd44.tar.gz
Imported from /srv/lorry/lorry-area/mercurial-tarball/mercurial-1.9.3.tar.gz.HEADmercurial-1.9.3master
Diffstat (limited to 'contrib/setup3k.py')
-rw-r--r--contrib/setup3k.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/setup3k.py b/contrib/setup3k.py
index 55cf36f..6957908 100644
--- a/contrib/setup3k.py
+++ b/contrib/setup3k.py
@@ -8,7 +8,7 @@ from distutils.command.build_py import build_py_2to3
from lib2to3.refactor import get_fixers_from_package as getfixers
import sys
-if getattr(sys, 'version_info', (0, 0, 0)) < (2, 4, 0, 'final'):
+if not hasattr(sys, 'version_info') or sys.version_info < (2, 4, 0, 'final'):
raise SystemExit("Mercurial requires Python 2.4 or later.")
if sys.version_info[0] >= 3:
@@ -26,22 +26,22 @@ else:
try:
import hashlib
sha = hashlib.sha1()
-except ImportError:
+except:
try:
import sha
- except ImportError:
+ except:
raise SystemExit(
"Couldn't import standard hashlib (incomplete Python install).")
try:
import zlib
-except ImportError:
+except:
raise SystemExit(
"Couldn't import standard zlib (incomplete Python install).")
try:
import bz2
-except ImportError:
+except:
raise SystemExit(
"Couldn't import standard bz2 (incomplete Python install).")
@@ -84,7 +84,7 @@ def hasfunction(cc, funcname):
os.dup2(devnull.fileno(), sys.stderr.fileno())
objects = cc.compile([fname], output_dir=tmpdir)
cc.link_executable(objects, os.path.join(tmpdir, "a.out"))
- except Exception:
+ except:
return False
return True
finally:
@@ -236,7 +236,7 @@ class hgbuildext(build_ext):
try:
build_ext.build_extension(self, ext)
except CCompilerError:
- if getattr(ext, 'optional', False):
+ if not hasattr(ext, 'optional') or not ext.optional:
raise
log.warn("Failed to build optional extension '%s' (skipping)",
ext.name)