Minor changes, created MANIFEST.in
This commit is contained in:
parent
956eeab186
commit
9a6d021778
11 changed files with 46 additions and 45 deletions
4
MANIFEST.in
Normal file
4
MANIFEST.in
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
include test/*.py
|
||||||
|
include test/ref/*
|
||||||
|
include MMGenLive/build_system.sh
|
||||||
|
prune test/ref/__db*
|
||||||
|
|
@ -23,7 +23,6 @@ mmgen-addrimport: Import addresses into a MMGen bitcoind tracking wallet
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from mmgen.common import *
|
from mmgen.common import *
|
||||||
from mmgen.tx import connect_to_bitcoind
|
|
||||||
from mmgen.addr import AddrInfo,AddrInfoEntry
|
from mmgen.addr import AddrInfo,AddrInfoEntry
|
||||||
|
|
||||||
opts_data = {
|
opts_data = {
|
||||||
|
|
@ -78,7 +77,7 @@ m = (' from Seed ID %s' % ai.seed_id) if ai.seed_id else ''
|
||||||
qmsg('OK. %s addresses%s' % (ai.num_addrs,m))
|
qmsg('OK. %s addresses%s' % (ai.num_addrs,m))
|
||||||
|
|
||||||
if not opt.test:
|
if not opt.test:
|
||||||
c = connect_to_bitcoind()
|
c = bitcoin_connection()
|
||||||
|
|
||||||
m = """
|
m = """
|
||||||
WARNING: You've chosen the '--rescan' option. Rescanning the blockchain is
|
WARNING: You've chosen the '--rescan' option. Rescanning the blockchain is
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ cmd_args = opts.init(opts_data)
|
||||||
if opt.comment_file:
|
if opt.comment_file:
|
||||||
comment = get_tx_comment_from_file(opt.comment_file)
|
comment = get_tx_comment_from_file(opt.comment_file)
|
||||||
|
|
||||||
c = connect_to_bitcoind()
|
c = bitcoin_connection()
|
||||||
|
|
||||||
if not opt.info:
|
if not opt.info:
|
||||||
do_license_msg(immed=True)
|
do_license_msg(immed=True)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ metadata,tx_hex,inputs_data,b2m_map,comment = parse_tx_file(tx_data,infile)
|
||||||
|
|
||||||
qmsg("Signed transaction file '%s' is valid" % infile)
|
qmsg("Signed transaction file '%s' is valid" % infile)
|
||||||
|
|
||||||
c = connect_to_bitcoind()
|
c = bitcoin_connection()
|
||||||
|
|
||||||
prompt_and_view_tx_data(c,'View transaction data?',
|
prompt_and_view_tx_data(c,'View transaction data?',
|
||||||
inputs_data,tx_hex,b2m_map,comment,metadata)
|
inputs_data,tx_hex,b2m_map,comment,metadata)
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ infiles = opts.init(opts_data,add_opts=['b16'])
|
||||||
if not infiles: opts.usage()
|
if not infiles: opts.usage()
|
||||||
for i in infiles: check_infile(i)
|
for i in infiles: check_infile(i)
|
||||||
|
|
||||||
c = connect_to_bitcoind()
|
c = bitcoin_connection()
|
||||||
|
|
||||||
saved_seeds = {}
|
saved_seeds = {}
|
||||||
tx_files = [i for i in infiles if get_extension(i) == g.rawtx_ext]
|
tx_files = [i for i in infiles if get_extension(i) == g.rawtx_ext]
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ def usage():
|
||||||
def print_version_info():
|
def print_version_info():
|
||||||
Msg("""
|
Msg("""
|
||||||
{pgnm_uc} version {g.version}
|
{pgnm_uc} version {g.version}
|
||||||
Part of the {pnm} suite, a Bitcoin cold-storage solution for the com-
|
Part of the {pnm} suite, a Bitcoin cold-storage solution for the command line.
|
||||||
mand line. Copyright (C) {g.Cdates} {g.author} {g.email}
|
Copyright (C) {g.Cdates} {g.author} {g.email}
|
||||||
""".format(pnm=g.proj_name, g=g, pgnm_uc=g.prog_name.upper()).strip())
|
""".format(pnm=g.proj_name, g=g, pgnm_uc=g.prog_name.upper()).strip())
|
||||||
|
|
||||||
def die_on_incompatible_opts(incompat_list):
|
def die_on_incompatible_opts(incompat_list):
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,7 @@ def listaddresses(addrs='',minconf=1,showempty=False,pager=False,showbtcaddrs=Fa
|
||||||
if not tmp: return False
|
if not tmp: return False
|
||||||
usr_addr_list = ['%s:%s' % (sid,i) for i in tmp]
|
usr_addr_list = ['%s:%s' % (sid,i) for i in tmp]
|
||||||
|
|
||||||
c = connect_to_bitcoind()
|
c = bitcoin_connection()
|
||||||
|
|
||||||
addrs = {} # reusing variable name!
|
addrs = {} # reusing variable name!
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
@ -444,7 +444,7 @@ def listaddresses(addrs='',minconf=1,showempty=False,pager=False,showbtcaddrs=Fa
|
||||||
def getbalance(minconf=1):
|
def getbalance(minconf=1):
|
||||||
|
|
||||||
accts = {}
|
accts = {}
|
||||||
for d in connect_to_bitcoind().listunspent(0):
|
for d in bitcoin_connection().listunspent(0):
|
||||||
ma = split2(d['account'])[0]
|
ma = split2(d['account'])[0]
|
||||||
keys = ['TOTAL']
|
keys = ['TOTAL']
|
||||||
if d['spendable']: keys += ['SPENDABLE']
|
if d['spendable']: keys += ['SPENDABLE']
|
||||||
|
|
@ -465,7 +465,7 @@ def getbalance(minconf=1):
|
||||||
for a in accts[key]]))
|
for a in accts[key]]))
|
||||||
|
|
||||||
def txview(infile,pager=False,terse=False):
|
def txview(infile,pager=False,terse=False):
|
||||||
c = connect_to_bitcoind()
|
c = bitcoin_connection()
|
||||||
tx_data = get_lines_from_file(infile,'transaction data')
|
tx_data = get_lines_from_file(infile,'transaction data')
|
||||||
|
|
||||||
metadata,tx_hex,inputs_data,b2m_map,comment = parse_tx_file(tx_data,infile)
|
metadata,tx_hex,inputs_data,b2m_map,comment = parse_tx_file(tx_data,infile)
|
||||||
|
|
@ -476,7 +476,7 @@ def add_label(mmaddr,label,remove=False):
|
||||||
die(1,'{a}: not a valid {pnm} address'.format(pnm=pnm,a=mmaddr))
|
die(1,'{a}: not a valid {pnm} address'.format(pnm=pnm,a=mmaddr))
|
||||||
check_addr_label(label) # Exits on failure
|
check_addr_label(label) # Exits on failure
|
||||||
|
|
||||||
c = connect_to_bitcoind()
|
c = bitcoin_connection()
|
||||||
|
|
||||||
from mmgen.addr import AddrInfoList
|
from mmgen.addr import AddrInfoList
|
||||||
btcaddr = AddrInfoList(bitcoind_connection=c).mmaddr2btcaddr(mmaddr)
|
btcaddr = AddrInfoList(bitcoind_connection=c).mmaddr2btcaddr(mmaddr)
|
||||||
|
|
|
||||||
29
mmgen/tx.py
29
mmgen/tx.py
|
|
@ -309,32 +309,3 @@ def mmaddr2btcaddr_addrdata(mmaddr,addr_data,source=''):
|
||||||
return addr_data[seed_id][idx]
|
return addr_data[seed_id][idx]
|
||||||
|
|
||||||
return '',''
|
return '',''
|
||||||
|
|
||||||
def get_bitcoind_cfg_options(cfg_keys):
|
|
||||||
|
|
||||||
cfg_file = os.path.join(get_homedir(), get_datadir(), 'bitcoin.conf')
|
|
||||||
|
|
||||||
cfg = dict([(k,v) for k,v in [split2(line.translate(None,'\t '),'=')
|
|
||||||
for line in get_lines_from_file(cfg_file)] if k in cfg_keys])
|
|
||||||
|
|
||||||
for k in set(cfg_keys) - set(cfg.keys()): cfg[k] = ''
|
|
||||||
return cfg
|
|
||||||
|
|
||||||
def get_bitcoind_auth_cookie():
|
|
||||||
|
|
||||||
f = os.path.join(get_homedir(), get_datadir(), '.cookie')
|
|
||||||
|
|
||||||
if file_is_readable(f):
|
|
||||||
return get_lines_from_file(f)[0]
|
|
||||||
else:
|
|
||||||
return ''
|
|
||||||
|
|
||||||
def connect_to_bitcoind():
|
|
||||||
|
|
||||||
host,port,user,passwd = 'localhost',8332,'rpcuser','rpcpassword'
|
|
||||||
cfg = get_bitcoind_cfg_options((user,passwd))
|
|
||||||
auth_cookie = get_bitcoind_auth_cookie()
|
|
||||||
|
|
||||||
import mmgen.rpc
|
|
||||||
return mmgen.rpc.BitcoinRPCConnection(
|
|
||||||
host,port,cfg[user],cfg[passwd],auth_cookie=auth_cookie)
|
|
||||||
|
|
|
||||||
|
|
@ -759,3 +759,35 @@ def do_license_msg(immed=False):
|
||||||
else:
|
else:
|
||||||
msg_r('\r')
|
msg_r('\r')
|
||||||
msg('')
|
msg('')
|
||||||
|
|
||||||
|
|
||||||
|
def get_bitcoind_cfg_options(cfg_keys):
|
||||||
|
|
||||||
|
cfg_file = os.path.join(get_homedir(), get_datadir(), 'bitcoin.conf')
|
||||||
|
|
||||||
|
cfg = dict([(k,v) for k,v in [split2(line.translate(None,'\t '),'=')
|
||||||
|
for line in get_lines_from_file(cfg_file)] if k in cfg_keys]) \
|
||||||
|
if file_is_readable(cfg_file) else {}
|
||||||
|
|
||||||
|
for k in set(cfg_keys) - set(cfg.keys()): cfg[k] = ''
|
||||||
|
|
||||||
|
return cfg
|
||||||
|
|
||||||
|
def get_bitcoind_auth_cookie():
|
||||||
|
|
||||||
|
f = os.path.join(get_homedir(), get_datadir(), '.cookie')
|
||||||
|
|
||||||
|
if file_is_readable(f):
|
||||||
|
return get_lines_from_file(f)[0]
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
def bitcoin_connection():
|
||||||
|
|
||||||
|
host,port,user,passwd = 'localhost',8332,'rpcuser','rpcpassword'
|
||||||
|
cfg = get_bitcoind_cfg_options((user,passwd))
|
||||||
|
auth_cookie = get_bitcoind_auth_cookie()
|
||||||
|
|
||||||
|
import mmgen.rpc
|
||||||
|
return mmgen.rpc.BitcoinRPCConnection(
|
||||||
|
host,port,cfg[user],cfg[passwd],auth_cookie=auth_cookie)
|
||||||
|
|
|
||||||
5
setup.py
5
setup.py
|
|
@ -60,11 +60,6 @@ setup(
|
||||||
|
|
||||||
'mmgen.share.__init__',
|
'mmgen.share.__init__',
|
||||||
'mmgen.share.Opts',
|
'mmgen.share.Opts',
|
||||||
|
|
||||||
'test.__init__',
|
|
||||||
'test.test',
|
|
||||||
'test.tooltest',
|
|
||||||
'test.gentest',
|
|
||||||
],
|
],
|
||||||
scripts=[
|
scripts=[
|
||||||
'mmgen-addrgen',
|
'mmgen-addrgen',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue