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

Method do_new

handler.py:401–434  ·  view source on GitHub ↗
(self, args)

Source from the content-addressed store, hash-verified

399 return self._build_target(path, args, debug=debug)
400
401 def do_new(self, args):
402 c = self._get_config()
403 n = c['counter'] + 1
404
405 while True:
406 name = 'project-%d' % n
407 path = os.path.join(self._get_path(), name)
408 if not os.path.exists(path):
409 logging.info('Make project path %s', path)
410 os.mkdir(path)
411 break
412 n += 1
413
414 args['id'] = n
415 args['name'] = name
416 args['path'] = path
417 if not args.get('title', ''):
418 args['title'] = os.path.basename(args.get('src'))
419 data = self._build_data(args)
420
421 cmd_args = ['init', '--src', data['src'], path]
422 call_pyarmor(cmd_args)
423
424 project = Project()
425 project.open(path)
426 project._update(data)
427 project.save(path)
428
429 c['projects'].append(args)
430 c['counter'] = n
431 self._set_config(c)
432
433 logging.info('Create project: %s', args)
434 return args
435
436 def do_update(self, args):
437 data = self._build_data(args)

Callers

nothing calls this directly

Calls 5

_build_dataMethod · 0.95
_get_configMethod · 0.80
_get_pathMethod · 0.80
_set_configMethod · 0.80
call_pyarmorFunction · 0.70

Tested by

no test coverage detected