New bypy CLI

This commit is contained in:
Kovid Goyal 2021-12-17 07:57:35 +05:30
parent d25bfd9d42
commit 88ef56f5cc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -25,18 +25,17 @@ def get_exe():
return 'python3' if sys.version_info.major == 2 else sys.executable return 'python3' if sys.version_info.major == 2 else sys.executable
def get_cmd(exe, bypy, which, bitness, sign_installers, notarize=True, compression_level='9'): def get_cmd(exe, bypy, which, bitness, sign_installers, notarize=True, compression_level='9', action='program'):
cmd = [exe, bypy, which] cmd = [exe, bypy, which]
if bitness and bitness == '32': if bitness and bitness != '64':
cmd.append(bitness) cmd += ['--arch', bitness]
cmd.append('program') cmd.append(action)
if not sys.stdout.isatty(): if action == 'program':
cmd.append('--no-tty') if sign_installers or notarize:
if sign_installers or notarize: cmd.append('--sign-installers')
cmd.append('--sign-installers') if notarize:
if notarize: cmd.append('--notarize')
cmd.append('--notarize') cmd.append('--compression-level=' + compression_level)
cmd.append('--compression-level=' + compression_level)
return cmd return cmd
@ -62,7 +61,7 @@ def build_only(which, bitness, spec, shutdown=False):
dist = get_dist(base, which, bitness) dist = get_dist(base, which, bitness)
dist = os.path.join(dist, 'c-extensions') dist = os.path.join(dist, 'c-extensions')
if shutdown: if shutdown:
cmd = [exe, bypy, which, 'shutdown'] cmd = get_cmd(action='shutdown')
subprocess.Popen(cmd).wait() subprocess.Popen(cmd).wait()
return dist return dist
@ -87,7 +86,7 @@ def build_single(which='windows', bitness='64', shutdown=True, sign_installers=T
pass pass
os.link(src, dest) os.link(src, dest)
if shutdown: if shutdown:
cmd = [exe, bypy, which, 'shutdown'] cmd = get_cmd(action='shutdown')
subprocess.Popen(cmd).wait() subprocess.Popen(cmd).wait()