From: Zooko O'Whielacronx Date: Tue, 19 May 2009 19:45:55 +0000 (-0700) Subject: setup: make Tahoe exit at startup with a useful error message if the base64.py module... X-Git-Url: https://git.rkrishnan.org/vdrive/%22news.html/simplejson/nxhtml.html?a=commitdiff_plain;h=8df5fc8d81f69c2acc3339a53c340b94a8a73d12;p=tahoe-lafs%2Ftahoe-lafs.git setup: make Tahoe exit at startup with a useful error message if the base64.py module is buggy (fixes part of #710) --- diff --git a/_auto_deps.py b/_auto_deps.py index 5f08a82c..0b0ca599 100644 --- a/_auto_deps.py +++ b/_auto_deps.py @@ -39,6 +39,19 @@ import sys if hasattr(sys, 'frozen'): # for py2exe install_requires=[] +def require_python_2_with_working_base64(): + import sys + if sys.version_info[0] != 2: + raise NotImplementedError("Tahoe-LAFS current requires Python v2.4.2 or greater (but less than v3), not %r" % (sys.version_info,)) + + # make sure we have a working base64.b32decode. The one in + # python2.4.[01] was broken. + nodeid_b32 = 't5g7egomnnktbpydbuijt6zgtmw4oqi5' + from base64 import b32decode + nodeid = b32decode(nodeid_b32) + if nodeid != "\x9fM\xf2\x19\xcckU0\xbf\x03\r\x10\x99\xfb&\x9b-\xc7A\x1d": + raise NotImplementedError("There is a bug in this base64 module: %r. This was a known issue in Python v2.4.0 and v2.4.1 (http://bugs.python.org/issue1171487 ). Tahoe-LAFS current requires Python v2.4.2 or greater (but less than v3). The current Python version is %r" % (base64, sys.version_info,)) + def require_auto_deps(): """ The purpose of this function is to raise a pkg_resources exception if any of the @@ -47,6 +60,8 @@ def require_auto_deps(): of these packages and gets an ImportError. This function gets called from src/allmydata/__init__.py . """ + require_python_2_with_working_base64() + import pkg_resources for requirement in install_requires: try: