electron/script/lib/config.py

72 lines
1.3 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
2014-01-31 04:18:30 +00:00
from __future__ import print_function
import os
2014-06-04 15:24:38 +00:00
import sys
PLATFORM = {
2014-06-04 15:24:38 +00:00
'cygwin': 'win32',
'msys': 'win32',
2014-06-04 15:24:38 +00:00
'darwin': 'darwin',
'linux': 'linux',
2014-06-04 15:24:38 +00:00
'linux2': 'linux',
'win32': 'win32',
}[sys.platform]
2014-12-08 17:00:35 +00:00
LINUX_BINARIES = [
'chrome-sandbox',
'chrome_crashpad_handler',
'electron',
'libEGL.so',
'libGLESv2.so',
'libffmpeg.so',
'libvk_swiftshader.so',
]
2014-12-08 17:00:35 +00:00
verbose_mode = False
2015-09-29 02:59:52 +00:00
def get_platform_key():
if 'MAS_BUILD' in os.environ:
2015-09-29 02:59:52 +00:00
return 'mas'
2022-03-21 02:11:21 +00:00
return PLATFORM
2015-09-29 02:59:52 +00:00
def get_target_arch():
arch = os.environ.get('TARGET_ARCH')
if arch is None:
return 'x64'
return arch
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:
print('Warning: Use $ELECTRON_' + name +
' instead of $ATOM_SHELL_' + name)
2016-05-25 00:33:44 +00:00
return value
2014-12-08 17:00:35 +00:00
def enable_verbose_mode():
print('Running in verbose mode')
2014-12-08 17:00:35 +00:00
global verbose_mode
verbose_mode = True
2014-12-08 17:00:35 +00:00
def is_verbose_mode():
return verbose_mode
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)
if suffix:
zip_name += '-' + suffix
return zip_name + '.zip'