From eaa063067027697ae365697ef5cccb39e9b96084 Mon Sep 17 00:00:00 2001 From: Zachary Gramana Date: Mon, 9 May 2011 15:16:56 -0400 Subject: [PATCH] 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) --- setup.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 2f3848fb46..6302a73f73 100644 --- a/setup.py +++ b/setup.py @@ -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 @@ except: 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