From d30fbba83745b8fff702ec93f6c604ada8975afc Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 5 Feb 2022 13:32:55 +0000 Subject: [PATCH] environment var rename: MMGEN_TRACEBACK -> MMGEN_EXEC_WRAPPER --- mmgen/base_proto/bitcoin/tx/unsigned.py | 2 +- mmgen/devtools.py | 2 +- mmgen/globalvars.py | 4 ++-- mmgen/main.py | 2 +- scripts/exec_wrapper.py | 2 +- test/test.py | 3 ++- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mmgen/base_proto/bitcoin/tx/unsigned.py b/mmgen/base_proto/bitcoin/tx/unsigned.py index 199aac36..fe2e54c3 100755 --- a/mmgen/base_proto/bitcoin/tx/unsigned.py +++ b/mmgen/base_proto/bitcoin/tx/unsigned.py @@ -78,7 +78,7 @@ class Unsigned(Completed,TxBase.Unsigned): return new except Exception as e: ymsg(f'\n{e.args[0]}') - if g.traceback: + if g.exec_wrapper: import traceback ymsg( '\n' + ''.join(traceback.format_exception(*sys.exc_info())) ) return False diff --git a/mmgen/devtools.py b/mmgen/devtools.py index 52f72d3b..baaee1e5 100755 --- a/mmgen/devtools.py +++ b/mmgen/devtools.py @@ -5,7 +5,7 @@ class MMGenObject(object): def immutable_attr_init_check(self): pass import os -if os.getenv('MMGEN_DEBUG') or os.getenv('MMGEN_TEST_SUITE') or os.getenv('MMGEN_TRACEBACK'): +if os.getenv('MMGEN_DEBUG') or os.getenv('MMGEN_TEST_SUITE') or os.getenv('MMGEN_EXEC_WRAPPER'): import sys,re,traceback,json,pprint from decimal import Decimal diff --git a/mmgen/globalvars.py b/mmgen/globalvars.py index e1b64cc8..7e33fa0d 100755 --- a/mmgen/globalvars.py +++ b/mmgen/globalvars.py @@ -113,7 +113,7 @@ class GlobalContext(Lockable): # test suite: bogus_send = False debug_utf8 = False - traceback = False + exec_wrapper = False test_suite = False test_suite_deterministic = False test_suite_popen_spawn = False @@ -253,7 +253,7 @@ class GlobalContext(Lockable): 'MMGEN_RPC_FAIL_ON_COMMAND', 'MMGEN_TESTNET', 'MMGEN_REGTEST', - 'MMGEN_TRACEBACK', + 'MMGEN_EXEC_WRAPPER', 'MMGEN_RPC_BACKEND', 'MMGEN_IGNORE_DAEMON_VERSION', 'MMGEN_USE_STANDALONE_SCRYPT_MODULE', diff --git a/mmgen/main.py b/mmgen/main.py index a5ec41fd..a2b052d0 100755 --- a/mmgen/main.py +++ b/mmgen/main.py @@ -43,7 +43,7 @@ def launch(mod): except EOFError: sys.stderr.write('\nEnd of file\n') except Exception as e: - if os.getenv('MMGEN_TRACEBACK'): + if os.getenv('MMGEN_EXEC_WRAPPER'): raise else: try: m = '{}'.format(e.args[0]) diff --git a/scripts/exec_wrapper.py b/scripts/exec_wrapper.py index 64d4976b..d983a87a 100755 --- a/scripts/exec_wrapper.py +++ b/scripts/exec_wrapper.py @@ -21,7 +21,7 @@ def exec_wrapper_init(): # don't change: name is used to test if script is runni from test.overlay import overlay_setup sys.path[0] = overlay_setup(repo_root=os.getcwd()) # assume we're in the repo root - os.environ['MMGEN_TRACEBACK'] = '1' + os.environ['MMGEN_EXEC_WRAPPER'] = '1' os.environ['PYTHONPATH'] = '.' if 'TMUX' in os.environ: del os.environ['TMUX'] diff --git a/test/test.py b/test/test.py index f0d94117..2d987884 100755 --- a/test/test.py +++ b/test/test.py @@ -724,7 +724,8 @@ class TestSuiteRunner(object): os.environ['MMGEN_FORCE_COLOR'] = '1' if self.ts.color else '' env = { 'EXEC_WRAPPER_SPAWN':'1' } - if 'exec_wrapper_init' in globals(): # Python 3.9: OR the dicts + if 'exec_wrapper_init' in globals(): # test.py itself is running under exec_wrapper + # Python 3.9: OR the dicts env.update({ 'EXEC_WRAPPER_NO_TRACEBACK':'1' }) env.update(os.environ)