Cleanups for suppression of UserWarnings. refs #1435
authordavid-sarah <david-sarah@jacaranda.org>
Thu, 18 Aug 2011 04:07:49 +0000 (21:07 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Thu, 18 Aug 2011 04:07:49 +0000 (21:07 -0700)
src/allmydata/__init__.py
src/allmydata/_auto_deps.py

index 06f8e15c6d7645f69290a28c7ec02c38ee0f2ceb..17e6ea0a9724f5bd66e273cc50e025eda5b6ef71 100644 (file)
@@ -144,8 +144,8 @@ def normalized_version(verstr, what=None):
 
 def get_package_versions_and_locations():
     import warnings
-    from _auto_deps import package_imports, deprecation_messages,  \
-        deprecation_imports, user_warning_messages
+    from _auto_deps import package_imports, deprecation_messages, \
+        user_warning_messages, warning_imports
 
     def package_dir(srcfile):
         return os.path.dirname(os.path.dirname(os.path.normcase(os.path.realpath(srcfile))))
@@ -171,16 +171,16 @@ def get_package_versions_and_locations():
     for msg in user_warning_messages:
         warnings.filterwarnings("ignore", category=UserWarning, message=msg, append=True)
     try:
-        for modulename in deprecation_imports:
+        for modulename in warning_imports:
             try:
                 __import__(modulename)
             except ImportError:
                 pass
     finally:
-        for ign in deprecation_messages:
-            warnings.filters.pop()
         for ign in user_warning_messages:
             warnings.filters.pop()
+        for ign in deprecation_messages:
+            warnings.filters.pop()
 
     packages = []
 
index 077c957b50e73e6786174d60eb3c6eb98f45d7d1..aa649ce5cd026e230cf4979cdfe85191d1d95f38 100644 (file)
@@ -117,13 +117,13 @@ deprecation_messages = [
     "the sets module is deprecated",
 ]
 
-deprecation_imports = [
+user_warning_messages = [
+    "Hashing uninitialized InterfaceClass instance",
+]
+
+warning_imports = [
     'nevow',
     'twisted.persisted.sob',
     'twisted.python.filepath',
     'Crypto.Hash.SHA',
 ]
-
-user_warning_messages = [
-    "Hashing uninitialized InterfaceClass instance",
-]