From 6e76653913708be36c919ceda66b27833e0d9e92 Mon Sep 17 00:00:00 2001
From: david-sarah <david-sarah@jacaranda.org>
Date: Sun, 31 Oct 2010 08:38:28 -0700
Subject: [PATCH] allmydata/__init__.py: call require_auto_deps() after
 importing nevow and twisted, reverting change in [4784]. Also fix a missing
 'warnings.filters.pop()'.

---
 src/allmydata/__init__.py | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py
index 0b5d74c9..bfefccbb 100644
--- a/src/allmydata/__init__.py
+++ b/src/allmydata/__init__.py
@@ -4,12 +4,6 @@ Decentralized storage grid.
 community web site: U{http://tahoe-lafs.org/}
 """
 
-# temporary hack to debug failure on midnightmagic's buildslave:
-import nevow
-
-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 .
@@ -40,6 +34,7 @@ finally:
     warnings.filters.pop()
     warnings.filters.pop()
     warnings.filters.pop()
+    warnings.filters.pop()
 
 # This warning is generated by twisted, PyRex, and possibly other packages,
 # but can happen at any time, not only when they are imported. See
@@ -48,6 +43,19 @@ warnings.filterwarnings("ignore", category=DeprecationWarning,
     message="BaseException.message has been deprecated as of Python 2.6",
     append=True)
 
+# Ideally we would call require_auto_deps() before importing nevow and twisted, but
+# that causes midnightmagic's NetBSD buildslave to be unable to import allmydata.test,
+# for reasons that are not understood. We want to call require_auto_deps() before other
+# imports because the setuptools docs claim that if a distribution is installed with
+# --multi-version, it might not importable until after pkg_resources.require()
+# has been called for it. We don't have an example of this happening at this time.
+# It is possible that require() isn't actually needed because we set __requires__
+# in the generated startup script, but that would be an undocumented property of the
+# setuptools implementation.
+
+from allmydata import _auto_deps
+_auto_deps.require_auto_deps()
+
 __version__ = "unknown"
 try:
     from allmydata._version import __version__
-- 
2.45.2