2014-01-31 04:18:30 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2019-06-15 17:26:09 +00:00
|
|
|
from __future__ import print_function
|
2015-04-11 09:58:19 +00:00
|
|
|
import os
|
2014-06-04 15:24:38 +00:00
|
|
|
import sys
|
|
|
|
|
2015-04-11 09:30:52 +00:00
|
|
|
PLATFORM = {
|
2014-06-04 15:24:38 +00:00
|
|
|
'cygwin': 'win32',
|
2021-06-02 07:29:19 +00:00
|
|
|
'msys': 'win32',
|
2014-06-04 15:24:38 +00:00
|
|
|
'darwin': 'darwin',
|
2019-11-19 14:08:20 +00:00
|
|
|
'linux': 'linux',
|
2014-06-04 15:24:38 +00:00
|
|
|
'linux2': 'linux',
|
|
|
|
'win32': 'win32',
|
|
|
|
}[sys.platform]
|
2014-12-08 17:00:35 +00:00
|
|
|
|
2019-11-21 01:21:44 +00:00
|
|
|
LINUX_BINARIES = [
|
|
|
|
'chrome-sandbox',
|
2022-01-20 03:48:48 +00:00
|
|
|
'crashpad_handler',
|
|
|
|
'electron',
|
2019-11-21 01:21:44 +00:00
|
|
|
'libEGL.so',
|
2022-01-20 03:48:48 +00:00
|
|
|
'libGLESv2.so',
|
|
|
|
'libffmpeg.so',
|
2022-01-31 09:57:52 +00:00
|
|
|
'libvk_swiftshader.so',
|
2022-01-20 03:48:48 +00:00
|
|
|
'swiftshader/libEGL.so',
|
|
|
|
'swiftshader/libGLESv2.so',
|
2019-11-21 01:21:44 +00:00
|
|
|
]
|
|
|
|
|
2014-12-08 17:00:35 +00:00
|
|
|
verbose_mode = False
|
|
|
|
|
2015-04-11 09:58:19 +00:00
|
|
|
|
2015-09-29 02:59:52 +00:00
|
|
|
def get_platform_key():
|
2020-10-30 10:05:38 +00:00
|
|
|
if 'MAS_BUILD' in os.environ:
|
2015-09-29 02:59:52 +00:00
|
|
|
return 'mas'
|
|
|
|
else:
|
|
|
|
return PLATFORM
|
|
|
|
|
|
|
|
|
2015-04-11 09:58:19 +00:00
|
|
|
def get_target_arch():
|
2018-09-29 04:13:17 +00:00
|
|
|
arch = os.environ.get('TARGET_ARCH')
|
|
|
|
if arch is None:
|
|
|
|
return 'x64'
|
|
|
|
return arch
|
2015-04-11 09:58:19 +00:00
|
|
|
|
|
|
|
|
2016-05-25 00:33:44 +00:00
|
|
|
def get_env_var(name):
|
|
|
|
value = os.environ.get('ELECTRON_' + name, '')
|
|
|
|
if not value:
|
|
|
|
# TODO Remove ATOM_SHELL_* fallback values
|
|
|
|
value = os.environ.get('ATOM_SHELL_' + name, '')
|
|
|
|
if value:
|
2019-06-15 17:26:09 +00:00
|
|
|
print('Warning: Use $ELECTRON_' + name +
|
|
|
|
' instead of $ATOM_SHELL_' + name)
|
2016-05-25 00:33:44 +00:00
|
|
|
return value
|
|
|
|
|
2015-07-08 04:32:47 +00:00
|
|
|
|
2015-04-12 04:00:02 +00:00
|
|
|
def s3_config():
|
2016-05-25 00:33:44 +00:00
|
|
|
config = (get_env_var('S3_BUCKET'),
|
|
|
|
get_env_var('S3_ACCESS_KEY'),
|
|
|
|
get_env_var('S3_SECRET_KEY'))
|
2016-05-24 17:27:46 +00:00
|
|
|
message = ('Error: Please set the $ELECTRON_S3_BUCKET, '
|
|
|
|
'$ELECTRON_S3_ACCESS_KEY, and '
|
|
|
|
'$ELECTRON_S3_SECRET_KEY environment variables')
|
2015-04-12 04:00:02 +00:00
|
|
|
assert all(len(c) for c in config), message
|
|
|
|
return config
|
|
|
|
|
|
|
|
|
2014-12-08 17:00:35 +00:00
|
|
|
def enable_verbose_mode():
|
2019-06-15 17:26:09 +00:00
|
|
|
print('Running in verbose mode')
|
2014-12-08 17:00:35 +00:00
|
|
|
global verbose_mode
|
|
|
|
verbose_mode = True
|
|
|
|
|
2015-04-11 09:58:19 +00:00
|
|
|
|
2014-12-08 17:00:35 +00:00
|
|
|
def is_verbose_mode():
|
|
|
|
return verbose_mode
|
2016-08-26 00:50:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
def get_zip_name(name, version, suffix=''):
|
2016-08-26 00:51:37 +00:00
|
|
|
arch = get_target_arch()
|
2016-09-01 12:00:29 +00:00
|
|
|
if arch == 'arm':
|
2016-08-26 00:51:37 +00:00
|
|
|
arch += 'v7l'
|
|
|
|
zip_name = '{0}-{1}-{2}-{3}'.format(name, version, get_platform_key(), arch)
|
2016-08-26 00:50:12 +00:00
|
|
|
if suffix:
|
|
|
|
zip_name += '-' + suffix
|
|
|
|
return zip_name + '.zip'
|