From: Zooko O'Whielacronx Date: Sat, 30 Oct 2010 08:10:35 +0000 (-0700) Subject: setup: run require_auto_deps() before attempting to import any deps in __init__.py X-Git-Tag: trac-4800~16 X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/FOOURL?a=commitdiff_plain;h=3b2d0d96091a6502f56a10c51ea6fdc7a359128d;p=tahoe-lafs%2Ftahoe-lafs.git setup: run require_auto_deps() before attempting to import any deps in __init__.py For one thing, this makes missing-dependency failures into DistributionNotFound errors instead of ImportErrors, which might be more useful to the user. For another thing, if someone is using distributions that were installed with --multi-version, then they might be not importable until after require_auto_deps() has been run. (The docs claim that this would be the case, but we don't have an example of this happening at this time.) --- diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py index efa3e7fb..3a5b2aaa 100644 --- a/src/allmydata/__init__.py +++ b/src/allmydata/__init__.py @@ -4,6 +4,9 @@ Decentralized storage grid. community web site: U{http://tahoe-lafs.org/} """ +from allmydata import _auto_deps +_auto_deps.require_auto_deps() + # This is just to suppress DeprecationWarnings from nevow and twisted. # See http://allmydata.org/trac/tahoe/ticket/859 and # http://divmod.org/trac/ticket/2994 . @@ -63,9 +66,6 @@ except ImportError: # http://allmydata.org/trac/tahoe/wiki/Versioning __full_version__ = __appname__ + '/' + str(__version__) -from allmydata import _auto_deps -_auto_deps.require_auto_deps() - import os, platform, re, subprocess, sys _distributor_id_cmdline_re = re.compile("(?:Distributor ID:)\s*(.*)", re.I) _release_cmdline_re = re.compile("(?:Release:)\s*(.*)", re.I)