minor fixes, cleanups, whitespace
This commit is contained in:
parent
333cbcf3ac
commit
77f4fd245d
7 changed files with 26 additions and 13 deletions
|
|
@ -47,7 +47,7 @@ class CfgFile(object):
|
|||
message = '{} not found at {!r}'
|
||||
|
||||
def __init__(self):
|
||||
self.fn = os.path.join(self.fn_dir,self.fn_base)
|
||||
self.fn = os.path.join(g.data_dir_root,self.fn_base)
|
||||
try:
|
||||
with open(self.fn) as fp:
|
||||
self.data = fp.read().splitlines()
|
||||
|
|
@ -172,7 +172,6 @@ class CfgFileSample(CfgFile):
|
|||
class CfgFileUsr(CfgFile):
|
||||
desc = 'user configuration file'
|
||||
warn_missing = False
|
||||
fn_dir = g.data_dir_root
|
||||
write_ok = True
|
||||
|
||||
def __init__(self):
|
||||
|
|
@ -201,7 +200,6 @@ class CfgFileSampleUsr(CfgFileSample):
|
|||
desc = 'sample configuration file'
|
||||
warn_missing = False
|
||||
fn_base = g.proj_name.lower() + '.cfg.sample'
|
||||
fn_dir = g.data_dir_root
|
||||
write_ok = True
|
||||
chksum = None
|
||||
write_metadata = True
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Configuration file for the MMGen suite
|
||||
# Everything following a '#' is ignored.
|
||||
|
||||
##################
|
||||
## User options ##
|
||||
##################
|
||||
#####################
|
||||
## General options ##
|
||||
#####################
|
||||
|
||||
# Uncomment to enable the curses-like scrolling UI for tracking wallet views
|
||||
# scroll true
|
||||
|
|
|
|||
|
|
@ -344,8 +344,8 @@ def init(
|
|||
if opt.data_dir:
|
||||
g.data_dir_root = os.path.normpath(os.path.abspath(opt.data_dir))
|
||||
elif os.getenv('MMGEN_TEST_SUITE'):
|
||||
from test.include.common import get_data_dir
|
||||
g.data_dir_root = get_data_dir()
|
||||
from test.include.common import get_test_data_dir
|
||||
g.data_dir_root = get_test_data_dir()
|
||||
else:
|
||||
g.data_dir_root = os.path.join(g.home_dir,'.'+g.proj_name.lower())
|
||||
|
||||
|
|
@ -410,7 +410,11 @@ def init(
|
|||
if g.bob or g.alice or g.carol or g.prog_name == 'mmgen-regtest':
|
||||
g.regtest_user = 'bob' if g.bob else 'alice' if g.alice else 'carol' if g.carol else None
|
||||
g.regtest = True
|
||||
g.data_dir = os.path.join(g.data_dir_root,'regtest',g.coin.lower(),(g.regtest_user or 'none'))
|
||||
g.data_dir = os.path.join(
|
||||
g.data_dir_root,
|
||||
'regtest',
|
||||
g.coin.lower(),
|
||||
(g.regtest_user or 'none') )
|
||||
|
||||
# === end global var initialization === #
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,12 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit):
|
|||
has_auth_cookie = True
|
||||
wallet_path = '/'
|
||||
|
||||
async def __init__(self,proto,daemon,backend,ignore_wallet):
|
||||
async def __init__(
|
||||
self,
|
||||
proto,
|
||||
daemon,
|
||||
backend,
|
||||
ignore_wallet ):
|
||||
|
||||
self.proto = proto
|
||||
self.daemon = daemon
|
||||
|
|
|
|||
|
|
@ -35,7 +35,13 @@ class CallSigs:
|
|||
|
||||
class EthereumRPCClient(RPCClient,metaclass=AsyncInit):
|
||||
|
||||
async def __init__(self,proto,daemon,backend,ignore_wallet):
|
||||
async def __init__(
|
||||
self,
|
||||
proto,
|
||||
daemon,
|
||||
backend,
|
||||
ignore_wallet ):
|
||||
|
||||
self.proto = proto
|
||||
self.daemon = daemon
|
||||
self.call_sigs = getattr(CallSigs,daemon.id,None)
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ def getrandstr(num_chars,no_space=False):
|
|||
n,m = (94,33) if no_space else (95,32)
|
||||
return ''.join( chr(i % n + m) for i in list(getrand(num_chars)) )
|
||||
|
||||
def get_data_dir():
|
||||
def get_test_data_dir():
|
||||
return os.path.join('test','data_dir' + ('','-α')[bool(os.getenv('MMGEN_DEBUG_UTF8'))])
|
||||
|
||||
# Windows uses non-UTF8 encodings in filesystem, so use raw bytes here
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ po = opts.init(opts_data,parse_only=True)
|
|||
from test.include.common import *
|
||||
from test.test_py_d.common import *
|
||||
|
||||
data_dir = get_data_dir() # include/common.py
|
||||
data_dir = get_test_data_dir() # include/common.py
|
||||
|
||||
# step 1: delete data_dir symlink in ./test;
|
||||
opt.resuming = any(k in po.user_opts for k in ('resume','resume_after'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue