def func_wrapper(*args, **kwargs): if wasm: prepare('codestore', 'codestore.wast', 'codestore.abi', __file__) prepare('renter', 'renter.wast', 'renter.abi', __file__) else: prepare('codestore', 'codestore.py', 'codestore.abi', __file__) prepare('renter', 'renter.py', 'renter.abi', __file__) sync = Sync('codestore', _dir=os.path.dirname(__file__), _ignore=['t.py', 'renter.py', 'codestore.py']) sync.deploy_mpy('math.py') return func(*args, **kwargs)
def deploy(d=True): sync = Sync('vmstore', _dir=os.path.dirname(__file__), _ignore=['t.py', 'vmstore.py']) if sys.platform == 'darwin': platform = '1' else: raise Exception("platform is not supported") if d: aa = [ # name type version path ['vm.wasm.'+platform+'.'+str(V), 0, V, "../libraries/vm_wasm/libvm_wasmd.dylib"], ['vm.py.'+platform+'.'+str(V), 1, V, "../libraries/vm_py/libvm_py-6d.dylib"], ['vm.eth.'+platform+'.'+str(V), 2, V, "../libraries/vm_eth/libvm_ethd.dylib"], ] else: aa = [ # name type version path ['vm.wasm.'+platform+'.'+str(V), 0, V, "../libraries/vm_wasm/libvm_wasm.dylib"], ['vm.py.'+platform+'.'+str(V), 1, V, "../libraries/vm_py/libvm_py-6.dylib"], ['vm.eth.'+platform+'.'+str(V), 2, V, "../libraries/vm_eth/libvm_eth.dylib"], ] for a in aa: debug.mp_set_max_execution_time(10000_000) # sync.deploy_vm(*a) deploy_vm(*a)
def deploy(d=True): if sys.platform == 'darwin': PLAT = '.1' else: raise Exception("platform is not supported") sync = Sync('native', _dir=os.path.dirname(__file__), _ignore=['t.py', 'native.py']) # name version path native lib name V = 3 aa = [['eosio.bios' + PLAT, V, 'eosio.bios', 'eosio_bios_native'], ['eosio.msig' + PLAT, V, 'eosio.msig', 'eosio_msig_native'], ['eosio.token' + PLAT, V, 'eosio.token', 'eosio_token_native'], ['eosio' + PLAT, V, 'eosio.system', 'eosio_system_native'], ['exchange' + PLAT, V, 'exchange', 'exchange_native']] debug.mp_set_max_execution_time(1000_000) for a in aa: if d: sync.deploy_native( a[0], a[1], '../../build-debug/contracts/{0}/lib{1}d.dylib'.format( a[2], a[3])) else: sync.deploy_native( a[0], a[1], '../../build/contracts/{0}/lib{1}.dylib'.format(a[2], a[3]))
def init(wasm=True): def init_decorator(func): def func_wrapper(*args, **kwargs): if wasm: prepare('lab', 'lab.wast', 'lab.abi', __file__) return func(*args, **kwargs) else: prepare('lab', 'lab.py', 'lab.abi', __file__) return func(*args, **kwargs) return func_wrapper return init_decorator _dir = os.path.dirname(os.path.abspath(__file__)) sync = Sync(_account = 'lab', _dir = _dir, _ignore = ['lab.py']) @init(True) def test(msg='hello,world'): with producer: r = eosapi.push_action('lab', 'sayhello', msg, {'lab':'active'}) assert r @init() def deploy(): sync.deploy_all() @init() def deploy_mpy(): sync.deploy_all_mpy()
from common import prepare, producer, Sync def init(func): def func_wrapper(*args, **kwargs): prepare('kitties', 'main.py', 'cryptokitties.abi', 2, __file__) return func(*args, **kwargs) return func_wrapper _dir = os.path.dirname(os.path.abspath(__file__)) sync = Sync(_account='kitties', _dir=_dir, _ignore=('main.py', 'test.py', 'ustruct.py', 'eoslib.py')) @init def deploy_depend_libs(): from backyard import test test.deploy_mpy() @init def deploy_all(): sync.deploy_all() @init