Let's not display deprecation warnings in release builds

This commit is contained in:
rdb 2016-03-25 16:41:58 +01:00
parent d906f55ebf
commit 6334f2511d
3 changed files with 10 additions and 6 deletions

View File

@ -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()

View File

@ -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(

View File

@ -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: