Add writers to core processors from export cli cmd
This commit is contained in:
parent
68867d09d2
commit
33c0dac678
@ -58,7 +58,8 @@ class Attachment(Data):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
s = ''
|
s = ''
|
||||||
for i in range(len(self.contents)):
|
#for i in range(len(self.contents)):
|
||||||
s += '{} = {}\n'.format(self.digests[i].hex(), self.contents[i])
|
for k in self.contents.keys():
|
||||||
|
s += '{} = {}\n'.format(k, self.contents[k]) #self.digests[i].hex(), self.contents[i])
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
@ -52,9 +52,9 @@ def execute(config, eargs):
|
|||||||
writers = init_writers_from_config(config)
|
writers = init_writers_from_config(config)
|
||||||
|
|
||||||
ct = Token(path=eargs.directory)
|
ct = Token(path=eargs.directory)
|
||||||
cm = Meta(path=eargs.directory, writer=writers['meta'])
|
cm = Meta(path=eargs.directory, writer=writers['meta'](path=eargs.output_directory))
|
||||||
ca = Attachment(path=eargs.directory, writer=writers['attachment'])
|
ca = Attachment(path=eargs.directory, writer=writers['attachment'](path=eargs.output_directory))
|
||||||
cp = Proof(path=eargs.directory, attachments=ca, writer=writers['proof'])
|
cp = Proof(path=eargs.directory, attachments=ca, writer=writers['proof'](path=eargs.output_directory))
|
||||||
cn = Network(path=eargs.directory)
|
cn = Network(path=eargs.directory)
|
||||||
|
|
||||||
ct.load()
|
ct.load()
|
||||||
@ -77,9 +77,8 @@ def execute(config, eargs):
|
|||||||
ref = cn.resource(eargs.target)
|
ref = cn.resource(eargs.target)
|
||||||
chain_spec = cn.chain_spec(eargs.target)
|
chain_spec = cn.chain_spec(eargs.target)
|
||||||
logg.debug('found reference {} chain spec {} for target {}'.format(ref['contents'], chain_spec, eargs.target))
|
logg.debug('found reference {} chain spec {} for target {}'.format(ref['contents'], chain_spec, eargs.target))
|
||||||
c = getattr(cmd_mod, 'new')(chain_spec, ref['contents'], cp, signer_hint=signer, rpc=rpc)
|
c = getattr(cmd_mod, 'new')(chain_spec, ref['contents'], cp, signer_hint=signer, rpc=rpc, outputs_writer=writers['ext'](path=eargs.output_directory))
|
||||||
c.apply_token(ct)
|
c.apply_token(ct)
|
||||||
|
|
||||||
p = Processor(proof=cp, attachment=ca, metadata=cm, extensions=[eargs.target])
|
p = Processor(proof=cp, attachment=ca, metadata=cm, extensions=[c])
|
||||||
|
p.process()
|
||||||
c.process(writer=writers['ext'](path=eargs.output_directory))
|
|
||||||
|
@ -156,7 +156,9 @@ class CICEth(Extension):
|
|||||||
if r == None:
|
if r == None:
|
||||||
r = code
|
r = code
|
||||||
|
|
||||||
self.add_outputs('token', r)
|
writer.write('token_address', self.token_address.encode('utf-8'))
|
||||||
|
writer.write('token', r.encode('utf-8'))
|
||||||
|
self.add_outputs('token', r.encode('utf-8'))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
@ -183,6 +185,7 @@ class CICEth(Extension):
|
|||||||
else:
|
else:
|
||||||
r = o
|
r = o
|
||||||
|
|
||||||
|
writer.write('token_index', r.encode('utf-8'))
|
||||||
self.add_outputs('token_index', r)
|
self.add_outputs('token_index', r)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
@ -230,5 +233,5 @@ class CICEth(Extension):
|
|||||||
self.token_address = add_0x(to_checksum_address(self.token_address))
|
self.token_address = add_0x(to_checksum_address(self.token_address))
|
||||||
|
|
||||||
|
|
||||||
def new(chain_spec, resources, proof, signer_hint=None, rpc=None):
|
def new(chain_spec, resources, proof, signer_hint=None, rpc=None, outputs_writer=None):
|
||||||
return CICEth(chain_spec, resources, proof, signer=signer_hint, rpc=rpc)
|
return CICEth(chain_spec, resources, proof, signer=signer_hint, rpc=rpc, outputs_writer=outputs_writer)
|
||||||
|
@ -30,7 +30,8 @@ class Processor:
|
|||||||
return outputs
|
return outputs
|
||||||
|
|
||||||
|
|
||||||
def process(self):
|
def process(self, writer=None):
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
'proof',
|
'proof',
|
||||||
'attachment',
|
'attachment',
|
||||||
@ -42,6 +43,7 @@ class Processor:
|
|||||||
|
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
a = self.cores.get(task)
|
a = self.cores.get(task)
|
||||||
|
logg.debug('>>>>>>> checking task {} {}'.format(task, a))
|
||||||
if a == None:
|
if a == None:
|
||||||
logg.debug('skipping missing task receiver "{}"'.format(task))
|
logg.debug('skipping missing task receiver "{}"'.format(task))
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user