MCPcopy Index your code
hub / github.com/dashingsoft/pyarmor-webui / _create

Method _create

handler8.py:494–519  ·  view source on GitHub ↗
(self, args, update=False)

Source from the content-addressed store, hash-verified

492 return args
493
494 def _create(self, args, update=False):
495 path = self._get_path()
496 output = self._format_path(args.get('output', path))
497
498 rcode = args['rcode']
499 filepath = os.path.join(output, rcode)
500 filename = os.path.join(filepath, 'pyarmor.rkey')
501 if os.path.exists(filename) and not update:
502 raise RuntimeError('The license "%s" already exists' % rcode)
503
504 cmd_args = ['gen', 'key', '--output', filepath]
505 device = []
506 for name, opt in self.options.items():
507 if name in args:
508 v = args.get(name)
509 if not v:
510 continue
511 if opt.startswith('-'):
512 cmd_args.extend([opt, v])
513 else:
514 device.append(opt + v)
515 if device:
516 cmd_args.extend(['-b', ''.join(device)])
517
518 call_pyarmor(cmd_args, homepath=self._config['homepath'])
519 return filename
520
521 def do_update(self, args):
522 c, p = self._get_license(args)

Callers 2

do_newMethod · 0.95
do_updateMethod · 0.95

Calls 3

_get_pathMethod · 0.80
_format_pathMethod · 0.80
call_pyarmorFunction · 0.70

Tested by

no test coverage detected