base: Silence execwarnings on dev.
Yes, this makes the warnings show up on client as well, because truth be told, having exec and eval calls on production builds is a very bad idea.
This commit is contained in:
parent
79cab772af
commit
869100692a
14 changed files with 21 additions and 19 deletions
|
@ -23,6 +23,7 @@ class AIBase:
|
||||||
self.config = getConfigShowbase()
|
self.config = getConfigShowbase()
|
||||||
__builtins__['__dev__'] = self.config.GetBool('want-dev', 0)
|
__builtins__['__dev__'] = self.config.GetBool('want-dev', 0)
|
||||||
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
|
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
|
||||||
|
__builtins__['__execWarnings__'] = self.config.GetBool('want-exec-warnings', 0)
|
||||||
logStackDump = (self.config.GetBool('log-stack-dump', (not __dev__)) or self.config.GetBool('ai-log-stack-dump', (not __dev__)))
|
logStackDump = (self.config.GetBool('log-stack-dump', (not __dev__)) or self.config.GetBool('ai-log-stack-dump', (not __dev__)))
|
||||||
uploadStackDump = self.config.GetBool('upload-stack-dump', 0)
|
uploadStackDump = self.config.GetBool('upload-stack-dump', 0)
|
||||||
if logStackDump or uploadStackDump:
|
if logStackDump or uploadStackDump:
|
||||||
|
|
|
@ -72,7 +72,7 @@ AIMsgName2Id = {'STATESERVER_OBJECT_GENERATE_WITH_REQUIRED': 2001,
|
||||||
'DBSERVER_SET_STORED_VALUES': 1014,
|
'DBSERVER_SET_STORED_VALUES': 1014,
|
||||||
'SERVER_PING': 5002}
|
'SERVER_PING': 5002}
|
||||||
AIMsgId2Names = invertDictLossless(AIMsgName2Id)
|
AIMsgId2Names = invertDictLossless(AIMsgName2Id)
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING AIMsgTypes: %s' % AIMsgName2Id)
|
print('EXECWARNING AIMsgTypes: %s' % AIMsgName2Id)
|
||||||
printStack()
|
printStack()
|
||||||
for name, value in list(AIMsgName2Id.items()):
|
for name, value in list(AIMsgName2Id.items()):
|
||||||
|
|
|
@ -100,16 +100,16 @@ class ChatInputNormal(DirectObject.DirectObject):
|
||||||
def __execMessage(self, message):
|
def __execMessage(self, message):
|
||||||
if not ChatInputNormal.ExecNamespace:
|
if not ChatInputNormal.ExecNamespace:
|
||||||
ChatInputNormal.ExecNamespace = {}
|
ChatInputNormal.ExecNamespace = {}
|
||||||
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
|
exec('from panda3d.core import *', globals(), self.ExecNamespace)
|
||||||
self.importExecNamespace()
|
self.importExecNamespace()
|
||||||
try:
|
try:
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING ChatInputNormal eval: %s' % message)
|
print('EXECWARNING ChatInputNormal eval: %s' % message)
|
||||||
printStack()
|
printStack()
|
||||||
return str(eval(message, globals(), ChatInputNormal.ExecNamespace))
|
return str(eval(message, globals(), ChatInputNormal.ExecNamespace))
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
try:
|
try:
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING ChatInputNormal exec: %s' % message)
|
print('EXECWARNING ChatInputNormal exec: %s' % message)
|
||||||
printStack()
|
printStack()
|
||||||
exec(message, globals(), ChatInputNormal.ExecNamespace)
|
exec(message, globals(), ChatInputNormal.ExecNamespace)
|
||||||
|
|
|
@ -130,13 +130,13 @@ class ChatInputTyped(DirectObject.DirectObject):
|
||||||
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
|
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
|
||||||
self.importExecNamespace()
|
self.importExecNamespace()
|
||||||
try:
|
try:
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING ChatInputNormal eval: %s' % message)
|
print('EXECWARNING ChatInputNormal eval: %s' % message)
|
||||||
printStack()
|
printStack()
|
||||||
return str(eval(message, globals(), ChatInputTyped.ExecNamespace))
|
return str(eval(message, globals(), ChatInputTyped.ExecNamespace))
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
try:
|
try:
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING ChatInputNormal exec: %s' % message)
|
print('EXECWARNING ChatInputNormal exec: %s' % message)
|
||||||
printStack()
|
printStack()
|
||||||
exec(message, globals(), ChatInputTyped.ExecNamespace)
|
exec(message, globals(), ChatInputTyped.ExecNamespace)
|
||||||
|
|
|
@ -285,16 +285,16 @@ class ChatInputWhiteListFrame(FSM.FSM, DirectFrame):
|
||||||
def __execMessage(self, message):
|
def __execMessage(self, message):
|
||||||
if not ChatInputTyped.ExecNamespace:
|
if not ChatInputTyped.ExecNamespace:
|
||||||
ChatInputTyped.ExecNamespace = {}
|
ChatInputTyped.ExecNamespace = {}
|
||||||
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
|
exec('from panda3d.core import *', globals(), self.ExecNamespace)
|
||||||
self.importExecNamespace()
|
self.importExecNamespace()
|
||||||
try:
|
try:
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING ChatInputWhiteListFrame eval: %s' % message)
|
print('EXECWARNING ChatInputWhiteListFrame eval: %s' % message)
|
||||||
printStack()
|
printStack()
|
||||||
return str(eval(message, globals(), ChatInputTyped.ExecNamespace))
|
return str(eval(message, globals(), ChatInputTyped.ExecNamespace))
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
try:
|
try:
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING ChatInputWhiteListFrame exec: %s' % message)
|
print('EXECWARNING ChatInputWhiteListFrame exec: %s' % message)
|
||||||
printStack()
|
printStack()
|
||||||
exec(message, globals(), ChatInputTyped.ExecNamespace)
|
exec(message, globals(), ChatInputTyped.ExecNamespace)
|
||||||
|
|
|
@ -249,16 +249,16 @@ class TalkAssistant(DirectObject.DirectObject):
|
||||||
print('execMessage %s' % message)
|
print('execMessage %s' % message)
|
||||||
if not TalkAssistant.ExecNamespace:
|
if not TalkAssistant.ExecNamespace:
|
||||||
TalkAssistant.ExecNamespace = {}
|
TalkAssistant.ExecNamespace = {}
|
||||||
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
|
exec('from panda3d.core import *', globals(), self.ExecNamespace)
|
||||||
self.importExecNamespace()
|
self.importExecNamespace()
|
||||||
try:
|
try:
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING TalkAssistant eval: %s' % message)
|
print('EXECWARNING TalkAssistant eval: %s' % message)
|
||||||
printStack()
|
printStack()
|
||||||
return str(eval(message, globals(), TalkAssistant.ExecNamespace))
|
return str(eval(message, globals(), TalkAssistant.ExecNamespace))
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
try:
|
try:
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING TalkAssistant exec: %s' % message)
|
print('EXECWARNING TalkAssistant exec: %s' % message)
|
||||||
printStack()
|
printStack()
|
||||||
exec(message, globals(), TalkAssistant.ExecNamespace)
|
exec(message, globals(), TalkAssistant.ExecNamespace)
|
||||||
|
|
|
@ -92,7 +92,7 @@ class LevelSpec:
|
||||||
|
|
||||||
def getCopyOfSpec(self, spec):
|
def getCopyOfSpec(self, spec):
|
||||||
specCopy = {}
|
specCopy = {}
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING LevelSpec exec: %s' % self.getSpecImportsModuleName())
|
print('EXECWARNING LevelSpec exec: %s' % self.getSpecImportsModuleName())
|
||||||
printStack()
|
printStack()
|
||||||
exec('from %s import *' % self.getSpecImportsModuleName())
|
exec('from %s import *' % self.getSpecImportsModuleName())
|
||||||
|
|
|
@ -11,6 +11,7 @@ class OTPBase(ShowBase):
|
||||||
self.wantEnviroDR = False
|
self.wantEnviroDR = False
|
||||||
ShowBase.__init__(self, windowType=windowType)
|
ShowBase.__init__(self, windowType=windowType)
|
||||||
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
|
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
|
||||||
|
__builtins__['__execWarnings__'] = self.config.GetBool('want-exec-warnings', 0)
|
||||||
OTPBase.notify.info('__astron__ == %s' % __astron__)
|
OTPBase.notify.info('__astron__ == %s' % __astron__)
|
||||||
if config.GetBool('want-phase-checker', 0):
|
if config.GetBool('want-phase-checker', 0):
|
||||||
from direct.showbase import Loader
|
from direct.showbase import Loader
|
||||||
|
|
|
@ -5,7 +5,7 @@ TTAIMsgName2Id = {'DBSERVER_GET_ESTATE': 1040,
|
||||||
'IN_GAME_NEWS_MANAGER_UD_TO_ALL_AI': 1043,
|
'IN_GAME_NEWS_MANAGER_UD_TO_ALL_AI': 1043,
|
||||||
'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044}
|
'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044}
|
||||||
TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id)
|
TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id)
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id)
|
print('EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id)
|
||||||
printStack()
|
printStack()
|
||||||
for name, value in list(TTAIMsgName2Id.items()):
|
for name, value in list(TTAIMsgName2Id.items()):
|
||||||
|
|
|
@ -41,7 +41,7 @@ BossbotCountryClubMiddleRoomIDs = (2, 5, 6)
|
||||||
BossbotCountryClubFinalRoomIDs = (18,)
|
BossbotCountryClubFinalRoomIDs = (18,)
|
||||||
BossbotCountryClubConnectorRooms = ('phase_12/models/bossbotHQ/Connector_Tunnel_A', 'phase_12/models/bossbotHQ/Connector_Tunnel_B')
|
BossbotCountryClubConnectorRooms = ('phase_12/models/bossbotHQ/Connector_Tunnel_A', 'phase_12/models/bossbotHQ/Connector_Tunnel_B')
|
||||||
CashbotMintSpecModules = {}
|
CashbotMintSpecModules = {}
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING CountryClubRoomSpecs: %s' % BossbotCountryClubRoomName2RoomId)
|
print('EXECWARNING CountryClubRoomSpecs: %s' % BossbotCountryClubRoomName2RoomId)
|
||||||
printStack()
|
printStack()
|
||||||
for roomName, roomId in list(BossbotCountryClubRoomName2RoomId.items()):
|
for roomName, roomId in list(BossbotCountryClubRoomName2RoomId.items()):
|
||||||
|
|
|
@ -62,7 +62,7 @@ CashbotMintMiddleRoomIDs = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1
|
||||||
CashbotMintFinalRoomIDs = (17, 18, 19, 20, 21, 22, 23, 24, 25)
|
CashbotMintFinalRoomIDs = (17, 18, 19, 20, 21, 22, 23, 24, 25)
|
||||||
CashbotMintConnectorRooms = ('phase_10/models/cashbotHQ/connector_7cubeL2', 'phase_10/models/cashbotHQ/connector_7cubeR2')
|
CashbotMintConnectorRooms = ('phase_10/models/cashbotHQ/connector_7cubeL2', 'phase_10/models/cashbotHQ/connector_7cubeR2')
|
||||||
CashbotMintSpecModules = {}
|
CashbotMintSpecModules = {}
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING MintRoomSpecs: %s' % CashbotMintRoomName2RoomId)
|
print('EXECWARNING MintRoomSpecs: %s' % CashbotMintRoomName2RoomId)
|
||||||
printStack()
|
printStack()
|
||||||
for roomName, roomId in list(CashbotMintRoomName2RoomId.items()):
|
for roomName, roomId in list(CashbotMintRoomName2RoomId.items()):
|
||||||
|
|
|
@ -48,7 +48,7 @@ CashbotStageMiddleRoomIDs = (1,)
|
||||||
CashbotStageFinalRoomIDs = (2,)
|
CashbotStageFinalRoomIDs = (2,)
|
||||||
CashbotStageConnectorRooms = ('phase_11/models/lawbotHQ/LB_connector_7cubeL2', 'phase_11/models/lawbotHQ/LB_connector_7cubeLR')
|
CashbotStageConnectorRooms = ('phase_11/models/lawbotHQ/LB_connector_7cubeL2', 'phase_11/models/lawbotHQ/LB_connector_7cubeLR')
|
||||||
CashbotStageSpecModules = {}
|
CashbotStageSpecModules = {}
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING StageRoomSpecs: %s' % CashbotStageRoomName2RoomId)
|
print('EXECWARNING StageRoomSpecs: %s' % CashbotStageRoomName2RoomId)
|
||||||
printStack()
|
printStack()
|
||||||
for roomName, roomId in list(CashbotStageRoomName2RoomId.items()):
|
for roomName, roomId in list(CashbotStageRoomName2RoomId.items()):
|
||||||
|
|
|
@ -785,7 +785,7 @@ class DistributedCannon(DistributedObject.DistributedObject):
|
||||||
if not self.toonHead:
|
if not self.toonHead:
|
||||||
return Task.done
|
return Task.done
|
||||||
flightResults = self.__calcFlightResults(avId, launchTime)
|
flightResults = self.__calcFlightResults(avId, launchTime)
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING DistributedCannon: %s' % flightResults)
|
print('EXECWARNING DistributedCannon: %s' % flightResults)
|
||||||
printStack()
|
printStack()
|
||||||
for key in flightResults:
|
for key in flightResults:
|
||||||
|
|
|
@ -262,7 +262,7 @@ class DistributedPartyCannonActivity(DistributedPartyActivity):
|
||||||
if self.isLocalToonId(toonId):
|
if self.isLocalToonId(toonId):
|
||||||
self.inWater = 0
|
self.inWater = 0
|
||||||
flightResults = self.__calcFlightResults(cannon, toonId, launchTime)
|
flightResults = self.__calcFlightResults(cannon, toonId, launchTime)
|
||||||
if not isClient():
|
if not __debug__ or __execWarnings__:
|
||||||
print('EXECWARNING DistributedPartyCannonActivity: %s' % flightResults)
|
print('EXECWARNING DistributedPartyCannonActivity: %s' % flightResults)
|
||||||
printStack()
|
printStack()
|
||||||
for key in flightResults:
|
for key in flightResults:
|
||||||
|
|
Loading…
Reference in a new issue