[msys2]: warn/exit on buggy, unsupported features
This commit is contained in:
parent
7ed00d98e5
commit
429ff7fa07
7 changed files with 31 additions and 1 deletions
|
|
@ -77,6 +77,9 @@
|
|||
# Set the Ethereum testnet name
|
||||
# eth_testnet_chain_name kovan
|
||||
|
||||
# Uncomment to suppress non-ASCII character password warning for MSWin / MSYS2
|
||||
# mswin_pw_warning false
|
||||
|
||||
#####################################################################
|
||||
# The following options are probably of interest only to developers #
|
||||
#####################################################################
|
||||
|
|
|
|||
|
|
@ -146,3 +146,16 @@ default wallet.
|
|||
pnu=g.proto.name.capitalize(),
|
||||
pnl=g.proj_name.lower())
|
||||
}[k] + ('-α' if g.debug_utf8 else '')
|
||||
|
||||
def exit_if_mswin(feature):
|
||||
if g.platform == 'win':
|
||||
m = capfirst(feature) + ' not supported on the MSWin / MSYS2 platform'
|
||||
ydie(1,m)
|
||||
|
||||
def mswin_pw_warning():
|
||||
if g.platform == 'win' and not opt.echo_passphrase and g.mswin_pw_warning:
|
||||
m = 'due to a bug in the MSYS2 Python implementation, if your passphrase\n'
|
||||
m += 'contains non-ASCII characters, you must turn on passphrase echoing with the\n'
|
||||
m += '--echo-passphrase option or use a password file. Otherwise, the non-ASCII\n'
|
||||
m += 'characters in your passphrase will be silently ignored!'
|
||||
msg(red('WARNING: ') + yellow(m))
|
||||
|
|
|
|||
|
|
@ -105,6 +105,9 @@ class g(object):
|
|||
test_suite = False
|
||||
test_suite_popen_spawn = False
|
||||
|
||||
# warnings
|
||||
mswin_pw_warning = True
|
||||
|
||||
for k in ('linux','win','msys'):
|
||||
if sys.platform[:len(k)] == k:
|
||||
platform = { 'linux':'linux', 'win':'win', 'msys':'win' }[k]
|
||||
|
|
@ -159,7 +162,7 @@ class g(object):
|
|||
'daemon_data_dir','force_256_color','regtest','subseeds',
|
||||
'btc_max_tx_fee','ltc_max_tx_fee','bch_max_tx_fee','eth_max_tx_fee',
|
||||
'eth_mainnet_chain_name','eth_testnet_chain_name',
|
||||
'max_tx_file_size','max_input_size'
|
||||
'max_tx_file_size','max_input_size','mswin_pw_warning'
|
||||
)
|
||||
# Supported environmental vars
|
||||
# The corresponding vars (lowercase, minus 'mmgen_') must be initialized in g
|
||||
|
|
@ -189,6 +192,7 @@ class g(object):
|
|||
'MMGEN_USE_STANDALONE_SCRYPT_MODULE',
|
||||
|
||||
'MMGEN_DISABLE_COLOR',
|
||||
'MMGEN_DISABLE_MSWIN_PW_WARNING',
|
||||
)
|
||||
|
||||
min_screen_width = 80
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ This command is currently available only on Linux-based platforms.
|
|||
|
||||
cmd_args = opts.init(opts_data,add_opts=['mmgen_keys_from_file','in_fmt'])
|
||||
|
||||
exit_if_mswin('autosigning')
|
||||
|
||||
import mmgen.tx
|
||||
import mmgen.altcoins.eth.tx
|
||||
from mmgen.txsign import txsign
|
||||
|
|
|
|||
|
|
@ -457,6 +457,7 @@ an empty passphrase, just hit ENTER twice.
|
|||
elif opt.echo_passphrase:
|
||||
pw = ' '.join(get_words_from_user('Enter {}: '.format(desc)))
|
||||
else:
|
||||
mswin_pw_warning()
|
||||
for i in range(g.passwd_max_tries):
|
||||
pw = ' '.join(get_words_from_user('Enter {}: '.format(desc)))
|
||||
pw2 = ' '.join(get_words_from_user('Repeat passphrase: '))
|
||||
|
|
@ -481,6 +482,7 @@ an empty passphrase, just hit ENTER twice.
|
|||
w = pwfile_reuse_warning()
|
||||
ret = ' '.join(get_words_from_file(opt.passwd_file,desc,quiet=w))
|
||||
else:
|
||||
mswin_pw_warning()
|
||||
ret = ' '.join(get_words_from_user('Enter {}: '.format(desc)))
|
||||
self.ssdata.passwd = ret
|
||||
|
||||
|
|
|
|||
|
|
@ -830,6 +830,8 @@ class MMGenToolCmdMonero(MMGenToolCmdBase):
|
|||
|
||||
def monero_wallet_ops(self,infile:str,op:str,blockheight=0,addrs=''):
|
||||
|
||||
exit_if_mswin('Monero wallet operations')
|
||||
|
||||
def run_cmd(cmd):
|
||||
import subprocess as sp
|
||||
p = sp.Popen(cmd,stdin=sp.PIPE,stdout=sp.PIPE,stderr=sp.PIPE)
|
||||
|
|
|
|||
|
|
@ -546,6 +546,8 @@ def get_new_passphrase(desc,passchg=False):
|
|||
elif opt.echo_passphrase:
|
||||
pw = ' '.join(get_words_from_user('Enter {}: '.format(w)))
|
||||
else:
|
||||
from mmgen.common import mswin_pw_warning
|
||||
mswin_pw_warning()
|
||||
for i in range(g.passwd_max_tries):
|
||||
pw = ' '.join(get_words_from_user('Enter {}: '.format(w)))
|
||||
pw2 = ' '.join(get_words_from_user('Repeat passphrase: '))
|
||||
|
|
@ -741,6 +743,8 @@ def get_mmgen_passphrase(desc,passchg=False):
|
|||
pwfile_reuse_warning()
|
||||
return ' '.join(get_words_from_file(opt.passwd_file,'passphrase'))
|
||||
else:
|
||||
from mmgen.common import mswin_pw_warning
|
||||
mswin_pw_warning()
|
||||
return ' '.join(get_words_from_user(prompt))
|
||||
|
||||
def my_raw_input(prompt,echo=True,insert_txt='',use_readline=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue