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

Method _build_target

handler.py:333–378  ·  view source on GitHub ↗
(self, path, args, debug=False)

Source from the content-addressed store, hash-verified

331 return result
332
333 def _build_target(self, path, args, debug=False):
334 target = args.get('buildTarget')
335 self._check_arg('target', target, valids=[0, 1, 2, 3])
336
337 src = self._format_path(args.get('src'))
338 name = args.get('bundleName')
339 output = self._format_path(args.get('output'))
340 if not output:
341 output = os.path.join(src, 'dist')
342
343 if target:
344 cmd_args = ['pack']
345 pack = args.get('pack', [])
346 self._check_arg('pack', pack, types=list)
347 options = self._handle_pack_options(src, pack)
348 if target in (2, 3):
349 options.append('--onefile')
350 if target == 3:
351 options.append('--runtime-hook')
352 p = os.path.dirname(os.path.abspath(__file__))
353 if p.find(' ') > -1:
354 s = "'%s'" % os.path.join(p, 'data', 'copy_license.py')
355 else:
356 s = os.path.join(p, 'data', 'copy_license.py')
357 options.append(s.replace('\\', '/'))
358
359 if options:
360 cmd_args.append('--options')
361 cmd_args.append(" %s" % (' '.join(options)))
362 if name:
363 cmd_args.extend(['--name', name])
364 if target == 3 or args.get('licenseFile') in ('false', 'outer'):
365 cmd_args.append('--without-license')
366 else:
367 cmd_args = ['build']
368 if args.get('noRuntime'):
369 cmd_args.append('--no-runtime')
370
371 if name:
372 output = os.path.join(output, name)
373 cmd_args.extend(['--output', output])
374
375 cmd_args.append(path)
376 run_pyarmor(cmd_args, debug=debug)
377
378 return output
379
380 def _build_temp(self, args, debug=False):
381 data = self._build_data(args)

Callers 2

_build_tempMethod · 0.95
do_buildMethod · 0.95

Calls 4

_handle_pack_optionsMethod · 0.95
run_pyarmorFunction · 0.85
_check_argMethod · 0.80
_format_pathMethod · 0.80

Tested by

no test coverage detected