Browse Source

Let's not display deprecation warnings in release builds

rdb 9 years ago
parent
commit
6334f2511d
3 changed files with 10 additions and 6 deletions
  1. 3 1
      direct/src/directbase/DirectStart.py
  2. 3 3
      direct/src/showbase/ShowBase.py
  3. 4 2
      makepanda/makepanda.py

+ 3 - 1
direct/src/directbase/DirectStart.py

@@ -1,7 +1,9 @@
 """ This is a deprecated module that creates a global instance of ShowBase. """
 
 __all__ = []
-print('Using deprecated DirectStart interface.')
+
+if __debug__:
+    print('Using deprecated DirectStart interface.')
 
 from direct.showbase import ShowBase
 base = ShowBase.ShowBase()

+ 3 - 3
direct/src/showbase/ShowBase.py

@@ -45,7 +45,7 @@ if __debug__:
 import AppRunnerGlobal
 
 def legacyRun():
-    builtins.base.notify.warning("run() is deprecated, use base.run() instead")
+    assert builtins.base.notify.warning("run() is deprecated, use base.run() instead")
     builtins.base.run()
 
 @atexit.register
@@ -1793,14 +1793,14 @@ class ShowBase(DirectObject.DirectObject):
     # backwards compatibility. Please do not add code here, add
     # it to the loader.
     def loadSfx(self, name):
-        self.notify.warning("base.loadSfx is deprecated, use base.loader.loadSfx instead.")
+        assert self.notify.warning("base.loadSfx is deprecated, use base.loader.loadSfx instead.")
         return self.loader.loadSfx(name)
 
     # This function should only be in the loader but is here for
     # backwards compatibility. Please do not add code here, add
     # it to the loader.
     def loadMusic(self, name):
-        self.notify.warning("base.loadMusic is deprecated, use base.loader.loadMusic instead.")
+        assert self.notify.warning("base.loadMusic is deprecated, use base.loader.loadMusic instead.")
         return self.loader.loadMusic(name)
 
     def playSfx(

+ 4 - 2
makepanda/makepanda.py

@@ -2671,7 +2671,8 @@ if not PkgSkip("PYTHON"):
 
     # Also add this file, for backward compatibility.
     ConditionalWriteFile(GetOutputDir() + '/panda3d/dtoolconfig.py', """
-print("Warning: panda3d.dtoolconfig is deprecated, use panda3d.interrogatedb instead.")
+if __debug__:
+    print("Warning: panda3d.dtoolconfig is deprecated, use panda3d.interrogatedb instead.")
 from .interrogatedb import *
 """)
 
@@ -2702,7 +2703,8 @@ if not PkgSkip("VRPN"):
 panda_modules_code = """
 "This module is deprecated.  Import from panda3d.core and other panda3d.* modules instead."
 
-print("Warning: pandac.PandaModules is deprecated, import from panda3d.core instead")
+if __debug__:
+    print("Warning: pandac.PandaModules is deprecated, import from panda3d.core instead")
 """
 
 for module in panda_modules: