zip-symbols.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env python3
  2. from __future__ import print_function
  3. import argparse
  4. import glob
  5. import os
  6. import sys
  7. from lib.config import PLATFORM, get_target_arch
  8. from lib.util import scoped_cwd, get_electron_version, make_zip, \
  9. get_electron_branding, get_out_dir, execute
  10. ELECTRON_VERSION = get_electron_version()
  11. PROJECT_NAME = get_electron_branding()['project_name']
  12. OUT_DIR = get_out_dir()
  13. def main():
  14. print('Zipping Symbols')
  15. if get_target_arch() == 'mips64el':
  16. return
  17. args = parse_args()
  18. dist_name = 'symbols.zip'
  19. zip_file = os.path.join(args.build_dir, dist_name)
  20. licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']
  21. with scoped_cwd(args.build_dir):
  22. dirs = ['breakpad_symbols']
  23. print('Making symbol zip: ' + zip_file)
  24. make_zip(zip_file, licenses, dirs)
  25. if PLATFORM == 'darwin':
  26. dsym_name = 'dsym.zip'
  27. with scoped_cwd(args.build_dir):
  28. dsyms = glob.glob('*.dSYM')
  29. dsym_zip_file = os.path.join(args.build_dir, dsym_name)
  30. print('Making dsym zip: ' + dsym_zip_file)
  31. make_zip(dsym_zip_file, licenses, dsyms)
  32. if len(dsyms) > 0 and 'DELETE_DSYMS_AFTER_ZIP' in os.environ:
  33. execute(['rm', '-rf'] + dsyms)
  34. elif PLATFORM == 'win32':
  35. pdb_name = 'pdb.zip'
  36. with scoped_cwd(args.build_dir):
  37. pdbs = glob.glob('*.pdb')
  38. pdb_zip_file = os.path.join(args.build_dir, pdb_name)
  39. print('Making pdb zip: ' + pdb_zip_file)
  40. make_zip(pdb_zip_file, pdbs + licenses, [])
  41. elif PLATFORM == 'linux':
  42. debug_name = 'debug.zip'
  43. with scoped_cwd(args.build_dir):
  44. dirs = ['debug']
  45. debug_zip_file = os.path.join(args.build_dir, debug_name)
  46. print('Making debug zip: ' + debug_zip_file)
  47. make_zip(debug_zip_file, licenses, dirs)
  48. def parse_args():
  49. parser = argparse.ArgumentParser(description='Zip symbols')
  50. parser.add_argument('-b', '--build-dir',
  51. help='Path to an Electron build folder.',
  52. default=OUT_DIR,
  53. required=False)
  54. return parser.parse_args()
  55. if __name__ == '__main__':
  56. sys.exit(main())