# HG changeset patch # User Zachary Gramana # Date 1304968616 14400 # Node ID bb7e3b3e6e1109249cb9e185da69e517ff3996dc # Parent 84256ba2fbf7e12b213d5ab4b93190616cbcdeed setup.py: workaround for missing bz2 module in IronPython IronPython does not provide the bz2 module on its own. This patch skips importing it to allow setup to continue. (minor tweaks by mpm) diff -r 84256ba2fbf7 -r bb7e3b3e6e11 setup.py --- a/setup.py Wed May 11 08:07:51 2011 -0500 +++ b/setup.py Mon May 09 15:16:56 2011 -0400 @@ -4,7 +4,7 @@ # 'python setup.py install', or # 'python setup.py --help' for more options -import sys +import sys, platform if not hasattr(sys, 'version_info') or sys.version_info < (2, 4, 0, 'final'): raise SystemExit("Mercurial requires Python 2.4 or later.") @@ -36,11 +36,21 @@ raise SystemExit( "Couldn't import standard zlib (incomplete Python install).") +# The base IronPython distribution (as of 2.7.1) doesn't support bz2 +isironpython = False try: - import bz2 + isironpython = platform.python_implementation().lower().find("ironpython") != -1 except: - raise SystemExit( - "Couldn't import standard bz2 (incomplete Python install).") + pass + +if isironpython: + print "warning: IronPython detected (no bz2 support)" +else: + try: + import bz2 + except: + raise SystemExit( + "Couldn't import standard bz2 (incomplete Python install).") import os, subprocess, time import shutil