Dont stip the binaries when using develop mode

This commit is contained in:
Kovid Goyal 2021-12-19 09:22:47 +05:30
parent cdcfbbe57e
commit 9e8d43c03a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 5 deletions

View File

@ -25,7 +25,7 @@ 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=False, notarize=True, compression_level='9', action='program'): def get_cmd(exe, bypy, which, bitness, sign_installers=False, notarize=True, compression_level='9', action='program', dont_strip=False):
cmd = [exe, bypy, which] cmd = [exe, bypy, which]
if bitness and bitness != '64': if bitness and bitness != '64':
cmd += ['--arch', bitness] cmd += ['--arch', bitness]
@ -35,6 +35,8 @@ def get_cmd(exe, bypy, which, bitness, sign_installers=False, notarize=True, com
cmd.append('--sign-installers') cmd.append('--sign-installers')
if notarize: if notarize:
cmd.append('--notarize') cmd.append('--notarize')
if dont_strip:
cmd.append('--dont-strip')
cmd.append('--compression-level=' + compression_level) cmd.append('--compression-level=' + compression_level)
return cmd return cmd
@ -66,10 +68,10 @@ def build_only(which, bitness, spec, shutdown=False):
return dist return dist
def build_single(which='windows', bitness='64', shutdown=True, sign_installers=True, notarize=True, compression_level='9'): def build_single(which='windows', bitness='64', shutdown=True, sign_installers=True, notarize=True, compression_level='9', dont_strip=False):
base, bypy = get_paths() base, bypy = get_paths()
exe = get_exe() exe = get_exe()
cmd = get_cmd(exe, bypy, which, bitness, sign_installers, notarize, compression_level=compression_level) cmd = get_cmd(exe, bypy, which, bitness, sign_installers, notarize, compression_level=compression_level, dont_strip=dont_strip)
ret = subprocess.Popen(cmd).wait() ret = subprocess.Popen(cmd).wait()
if ret != 0: if ret != 0:
raise SystemExit(ret) raise SystemExit(ret)
@ -128,12 +130,18 @@ class BuildInstaller(Command):
choices=list('123456789'), choices=list('123456789'),
help='Do not notarize the installers' help='Do not notarize the installers'
) )
parser.add_option(
'--dont-strip',
default=False,
action='store_true',
help='Do not strip the binaries'
)
def run(self, opts): def run(self, opts):
build_single( build_single(
self.OS, self.BITNESS, not opts.dont_shutdown, self.OS, self.BITNESS, not opts.dont_shutdown,
not opts.dont_sign, not opts.dont_notarize, not opts.dont_sign, not opts.dont_notarize,
compression_level=opts.compression_level compression_level=opts.compression_level, dont_strip=opts.dont_strip
) )

View File

@ -56,7 +56,7 @@ with tempfile.NamedTemporaryFile(prefix='install-dmg-', suffix='.py') as f:
cmd = './setup.py osx --dont-shutdown' cmd = './setup.py osx --dont-shutdown'
if 'develop' in sys.argv: if 'develop' in sys.argv:
print('Disabling code-signing and notarization') print('Disabling code-signing and notarization')
cmd += ' --dont-sign --dont-notarize' cmd += ' --dont-sign --dont-notarize --dont-strip'
run(cmd) run(cmd)
f.write(script.encode('utf-8')) f.write(script.encode('utf-8'))
f.flush() f.flush()