electron/script/upload-symbols.py

54 lines
1.4 KiB
Python
Raw Normal View History

2014-11-07 12:19:26 +00:00
#!/usr/bin/env python
import os
2014-11-07 12:51:25 +00:00
import glob
import sys
2014-11-07 12:19:26 +00:00
2018-05-23 19:53:48 +00:00
from lib.config import PLATFORM, s3_config, enable_verbose_mode
2016-05-25 16:10:46 +00:00
from lib.util import electron_gyp, execute, rm_rf, safe_mkdir, s3put
2014-11-07 12:19:26 +00:00
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
2018-05-23 19:53:48 +00:00
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
RELEASE_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
2016-05-25 16:10:46 +00:00
PROJECT_NAME = electron_gyp()['project_name%']
PRODUCT_NAME = electron_gyp()['product_name%']
2018-05-23 19:53:48 +00:00
if PLATFORM == 'win32':
SYMBOLS_DIR = os.path.join(DIST_DIR, 'symbols')
else:
SYMBOLS_DIR = os.path.join(DIST_DIR, '{0}.breakpad.syms'.format(PROJECT_NAME))
2014-11-07 12:19:26 +00:00
PDB_LIST = [
2018-05-23 19:53:48 +00:00
os.path.join(RELEASE_DIR, '{0}.exe.pdb'.format(PROJECT_NAME)),
os.path.join(RELEASE_DIR, 'node.dll.pdb')
2014-11-07 12:19:26 +00:00
]
def main():
os.chdir(SOURCE_ROOT)
2018-05-23 19:53:48 +00:00
if PLATFORM == 'win32':
for pdb in PDB_LIST:
run_symstore(pdb, SYMBOLS_DIR, PRODUCT_NAME)
files = glob.glob(SYMBOLS_DIR + '/*.pdb/*/*.pdb')
files = [f.lower() for f in files]
else:
files = glob.glob(SYMBOLS_DIR + '/*/*/*.sym')
2014-11-07 12:19:26 +00:00
2014-11-07 12:51:25 +00:00
bucket, access_key, secret_key = s3_config()
upload_symbols(bucket, access_key, secret_key, files)
2014-11-07 12:19:26 +00:00
def run_symstore(pdb, dest, product):
execute(['symstore', 'add', '/r', '/f', pdb, '/s', dest, '/t', product])
2014-11-07 12:51:25 +00:00
def upload_symbols(bucket, access_key, secret_key, files):
2014-11-10 15:33:56 +00:00
s3put(bucket, access_key, secret_key, SYMBOLS_DIR, 'atom-shell/symbols',
files)
2014-11-07 12:51:25 +00:00
2014-11-07 12:19:26 +00:00
if __name__ == '__main__':
sys.exit(main())