MSWin: remove set_vt100() function
This commit is contained in:
parent
05b297efca
commit
e1f236d241
9 changed files with 2 additions and 32 deletions
|
|
@ -49,12 +49,6 @@ _colors = {
|
|||
def nocolor(s):
|
||||
return s
|
||||
|
||||
def set_vt100():
|
||||
'hack to put term into VT100 mode under MSWin'
|
||||
if gc.platform == 'win32':
|
||||
from subprocess import run
|
||||
run([], shell=True) # nosec B602
|
||||
|
||||
def get_terminfo_colors(term=None):
|
||||
from subprocess import run, PIPE
|
||||
cmd = ['infocmp', '-0']
|
||||
|
|
@ -64,10 +58,8 @@ def get_terminfo_colors(term=None):
|
|||
try:
|
||||
cmdout = run(cmd, stdout=PIPE, check=True, text=True).stdout
|
||||
except:
|
||||
set_vt100()
|
||||
return None
|
||||
else:
|
||||
set_vt100()
|
||||
s = next(iter(e.split('#', 1)[1] for e in cmdout.split(',') if e.startswith('colors')))
|
||||
from .util import is_hex_str
|
||||
if s.isdecimal():
|
||||
|
|
@ -114,8 +106,6 @@ def init_color(num_colors='auto'):
|
|||
'\033[{};{}m'.format(*e[1]))
|
||||
getattr(self, c).__code__ = eval(f'(lambda s: "{start}" + s + "{reset}").__code__') # nosec B307
|
||||
|
||||
set_vt100()
|
||||
|
||||
# Each color name must be bound to an independent stub function with its own
|
||||
# address in memory. The names themselves must never be redefined, since other
|
||||
# modules could import them before init_color() is run. Instead, the code
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ from collections import namedtuple
|
|||
|
||||
from .cfg import gc
|
||||
from .base_obj import Lockable
|
||||
from .color import set_vt100
|
||||
from .util import msg, Msg_r, die, remove_dups, oneshot_warning, fmt_list
|
||||
from .flags import ClassFlags, ClassOpts
|
||||
|
||||
|
|
@ -84,7 +83,6 @@ class Daemon(Lockable):
|
|||
cp = run(cmd, check=False, stdout=out, stderr=out)
|
||||
except OSError as e:
|
||||
die('MMGenCalledProcessError', f'Error starting executable: {type(e).__name__} [Errno {e.errno}]')
|
||||
set_vt100()
|
||||
if check_retcode and cp.returncode:
|
||||
die(1, str(cp))
|
||||
if self.debug:
|
||||
|
|
@ -498,6 +496,5 @@ class CoinDaemon(Daemon):
|
|||
assert self.test_suite, 'datadir removal restricted to test suite'
|
||||
if self.state == 'stopped':
|
||||
run(['rm', '-rf', self.datadir])
|
||||
set_vt100()
|
||||
else:
|
||||
msg(f'Cannot remove {self.network_datadir!r} - daemon is not stopped')
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ fileutil: Routines that read, write, execute or stat files
|
|||
import sys, os
|
||||
|
||||
from .cfg import gc
|
||||
from .color import set_vt100
|
||||
from .util import (
|
||||
msg,
|
||||
die,
|
||||
|
|
@ -43,7 +42,6 @@ def check_or_create_dir(path):
|
|||
if os.getenv('MMGEN_TEST_SUITE') and os.path.exists(path): # path is a link or regular file
|
||||
from subprocess import run
|
||||
run(['rm', '-rf', str(path)])
|
||||
set_vt100()
|
||||
try:
|
||||
os.makedirs(path, 0o700)
|
||||
except:
|
||||
|
|
@ -55,7 +53,6 @@ def check_binary(args):
|
|||
run(args, stdout=DEVNULL, stderr=DEVNULL, check=True)
|
||||
except:
|
||||
die(2, f'{args[0]!r} binary missing, not in path, or not executable')
|
||||
set_vt100()
|
||||
|
||||
def shred_file(cfg, fn, *, iterations=30):
|
||||
check_binary(['shred', '--version'])
|
||||
|
|
@ -65,7 +62,6 @@ def shred_file(cfg, fn, *, iterations=30):
|
|||
+ (['--verbose'] if cfg.verbose else [])
|
||||
+ [str(fn)],
|
||||
check = True)
|
||||
set_vt100()
|
||||
|
||||
def _check_file_type_and_access(fname, ftype, *, blkdev_ok=False):
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,5 @@ class curl(base):
|
|||
dmsg_rpc(' RPC curl exec data ==>\n{}\n', exec_cmd)
|
||||
|
||||
from subprocess import run, PIPE
|
||||
from ...color import set_vt100
|
||||
res = run(exec_cmd, stdout=PIPE, check=True, text=True).stdout
|
||||
set_vt100()
|
||||
return (res[:-3], int(res[-3:]))
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ def do_pager(text):
|
|||
pagers = [os.environ['PAGER']] + pagers
|
||||
|
||||
from subprocess import run
|
||||
from .color import set_vt100
|
||||
for pager in pagers:
|
||||
try:
|
||||
m = text + ('' if pager == 'less' else end_msg)
|
||||
|
|
@ -162,7 +161,6 @@ def do_pager(text):
|
|||
break
|
||||
else:
|
||||
Msg(text+end_msg)
|
||||
set_vt100()
|
||||
|
||||
def do_license_msg(cfg, *, immed=False):
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ from subprocess import run, PIPE, DEVNULL
|
|||
from pathlib import Path
|
||||
|
||||
from mmgen.cfg import gc
|
||||
from mmgen.color import red, yellow, blue, cyan, orange, set_vt100
|
||||
from mmgen.color import red, yellow, blue, cyan, orange
|
||||
from mmgen.util import msg, msg_r, rmsg, die
|
||||
from mmgen.proto.eth.util import compute_contract_addr
|
||||
|
||||
|
|
@ -784,7 +784,6 @@ class CmdTestEthdev(CmdTestEthdevMethods, CmdTestBase, CmdTestShared):
|
|||
|
||||
if d.id in ('geth', 'erigon'):
|
||||
self.genesis_setup(d)
|
||||
set_vt100()
|
||||
|
||||
if d.id == 'erigon':
|
||||
self.write_to_tmpfile('signer_key', self.keystore_data['key']+'\n')
|
||||
|
|
@ -1793,5 +1792,4 @@ class CmdTestEthdev(CmdTestEthdevMethods, CmdTestBase, CmdTestShared):
|
|||
imsg('')
|
||||
elif not stop_test_daemons(self.proto.coin+'_rt', remove_datadir=True):
|
||||
return False
|
||||
set_vt100()
|
||||
return 'ok'
|
||||
|
|
|
|||
|
|
@ -125,8 +125,6 @@ class CmdTestInput(CmdTestBase):
|
|||
|
||||
cp = run(cmd, input=mn.encode(), capture_output=True, env=run_env)
|
||||
|
||||
from mmgen.color import set_vt100
|
||||
set_vt100()
|
||||
imsg(cp.stderr.decode().strip())
|
||||
res = get_data_from_file(self.cfg, 'test/trash/A773B05C[128].mmwords', silent=True).strip()
|
||||
assert res == mn, f'{res} != {mn}'
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@
|
|||
test.cmdtest_d.ref_altcoin: Altcoin reference file tests for the cmdtest.py test suite
|
||||
"""
|
||||
|
||||
from mmgen.color import set_vt100
|
||||
|
||||
from .include.common import pwfile, dfl_wpasswd, ref_dir, dfl_words_file, dfl_addr_idx_list
|
||||
from ..include.common import joinpath, start_test_daemons, stop_test_daemons, cmp_or_die
|
||||
from .ref import CmdTestRef
|
||||
|
|
@ -105,7 +103,6 @@ class CmdTestRefAltcoin(CmdTestRef, CmdTestBase):
|
|||
proto = MMGenTxFile.get_proto(self.cfg, txfile, quiet_open=True)
|
||||
if proto.sign_mode == 'daemon':
|
||||
start_test_daemons(proto.network_id)
|
||||
set_vt100()
|
||||
t = self.spawn(
|
||||
'mmgen-txsign',
|
||||
['--outdir=test/trash', '--yes', f'--passwd-file={passfile}', dfl_words_file, txfile],
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ os.chdir(parpar)
|
|||
sys.path[0] = os.curdir
|
||||
|
||||
from mmgen.cfg import Config, gc
|
||||
from mmgen.color import yellow, blue, cyan, set_vt100
|
||||
from mmgen.color import yellow, blue, cyan
|
||||
from mmgen.util import msg, ymsg, gmsg, fmt, fmt_list, die
|
||||
|
||||
commands = [
|
||||
|
|
@ -87,7 +87,6 @@ def tt_license():
|
|||
do_license_msg(cfg)
|
||||
|
||||
def tt_line_input():
|
||||
set_vt100()
|
||||
cmsg('Testing line_input():')
|
||||
msg(fmt("""
|
||||
At the Ready? prompt type and hold down "y".
|
||||
|
|
@ -166,7 +165,6 @@ def tt_txview():
|
|||
tx = UnsignedTX(cfg=cfg, filename=fn, quiet_open=True)
|
||||
while True:
|
||||
tx.info.view_with_prompt('View data for transaction?', pause=False)
|
||||
set_vt100()
|
||||
if not keypress_confirm(cfg, 'Continue testing transaction view?', default_yes=True):
|
||||
break
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue