From 6334f2511d1df347f516afe9e6a6e6d1cabebc7c Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 25 Mar 2016 16:41:58 +0100 Subject: [PATCH] Let's not display deprecation warnings in release builds --- direct/src/directbase/DirectStart.py | 4 +++- direct/src/showbase/ShowBase.py | 6 +++--- makepanda/makepanda.py | 6 ++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/direct/src/directbase/DirectStart.py b/direct/src/directbase/DirectStart.py index 6264b09486..031dc85323 100644 --- a/direct/src/directbase/DirectStart.py +++ b/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() diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 7d747fe42f..28aa140e8e 100644 --- a/direct/src/showbase/ShowBase.py +++ b/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( diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 575058e5ae..46554539d7 100755 --- a/makepanda/makepanda.py +++ b/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: