2014-01-31 04:18:30 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2015-04-11 10:26:15 +00:00
|
|
|
import errno
|
2015-04-11 09:58:19 +00:00
|
|
|
import os
|
2014-06-04 15:24:38 +00:00
|
|
|
import platform
|
|
|
|
import sys
|
|
|
|
|
2015-04-11 09:58:19 +00:00
|
|
|
|
2015-07-03 03:45:23 +00:00
|
|
|
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
|
2015-12-09 10:14:37 +00:00
|
|
|
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
|
2016-05-09 12:23:02 +00:00
|
|
|
LIBCHROMIUMCONTENT_COMMIT = 'f615ab6da33c860d526286a65dbb89b21074a784'
|
2014-06-04 15:24:38 +00:00
|
|
|
|
2015-04-11 09:30:52 +00:00
|
|
|
PLATFORM = {
|
2014-06-04 15:24:38 +00:00
|
|
|
'cygwin': 'win32',
|
|
|
|
'darwin': 'darwin',
|
|
|
|
'linux2': 'linux',
|
|
|
|
'win32': 'win32',
|
|
|
|
}[sys.platform]
|
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():
|
|
|
|
if os.environ.has_key('MAS_BUILD'):
|
|
|
|
return 'mas'
|
|
|
|
else:
|
|
|
|
return PLATFORM
|
|
|
|
|
|
|
|
|
2015-04-11 09:58:19 +00:00
|
|
|
def get_target_arch():
|
2015-07-01 07:47:21 +00:00
|
|
|
try:
|
|
|
|
target_arch_path = os.path.join(__file__, '..', '..', '..', 'vendor',
|
|
|
|
'brightray', 'vendor', 'download',
|
|
|
|
'libchromiumcontent', '.target_arch')
|
|
|
|
with open(os.path.normpath(target_arch_path)) as f:
|
|
|
|
return f.read().strip()
|
|
|
|
except IOError as e:
|
|
|
|
if e.errno != errno.ENOENT:
|
|
|
|
raise
|
|
|
|
|
|
|
|
if PLATFORM == 'win32':
|
2015-04-11 10:26:15 +00:00
|
|
|
return 'ia32'
|
2015-04-11 09:58:19 +00:00
|
|
|
else:
|
|
|
|
return 'x64'
|
|
|
|
|
|
|
|
|
2015-07-08 04:32:47 +00:00
|
|
|
def get_chromedriver_version():
|
|
|
|
return 'v2.15'
|
|
|
|
|
|
|
|
|
2015-04-12 04:00:02 +00:00
|
|
|
def s3_config():
|
|
|
|
config = (os.environ.get('ATOM_SHELL_S3_BUCKET', ''),
|
|
|
|
os.environ.get('ATOM_SHELL_S3_ACCESS_KEY', ''),
|
|
|
|
os.environ.get('ATOM_SHELL_S3_SECRET_KEY', ''))
|
|
|
|
message = ('Error: Please set the $ATOM_SHELL_S3_BUCKET, '
|
|
|
|
'$ATOM_SHELL_S3_ACCESS_KEY, and '
|
|
|
|
'$ATOM_SHELL_S3_SECRET_KEY environment variables')
|
|
|
|
assert all(len(c) for c in config), message
|
|
|
|
return config
|
|
|
|
|
|
|
|
|
2014-12-08 17:00:35 +00:00
|
|
|
def enable_verbose_mode():
|
|
|
|
print 'Running in verbose mode'
|
|
|
|
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
|