e315e4d308
* build: update-external-binaries fetches sccache * build: add util.add_exec_bit in scripts/ * build: use util.add_exec_bit in create-dist * build: use util.add_exec_bit in update-external-binaries this is needed to work around a bug in python's zipfile module that doesn't preserve the exec bit https://bugs.python.org/issue18262 * fix: linting errors * build: vsts, circleci use patched sccache * build: always look for the x64 sccache as it's the only arch we have it on * fix: windows-specific errors in updaste-external-binaries * fix: tyop * fix: set SCCACHE_BUCKET, SCCACHE_TWO_TIER on circleci * fix: syntax error in circleci yaml * fix: keep churning * chore: add tracer to file downloader * docs: add sccache instructions for GN builds * build: pull down the darwin sccache on mas builds * build: use gn sync verbosely on circleci and vsts * docs: copyediting * build: remove unnecessary cache-dir arg * docs: fix shell quoting in gn build instructions * fix: invoke gclient without -verbose in circleci * refactor: remove debug tracer * fix: invoke gclient without -verbose in appveyor * fix: invoke gclient without -verbose in vsts * fix: pull add_exec_bit from correct source * fix: remove 'SCCACHE_TWO_TIER' from CI scripts * refactor: remove SCCACHE_BUCKET from ci scripts this environment variable will be set via the CI UI instead * refactor: clarify log message * fix: set SCCACHE_PATH correctly for Windows CI
73 lines
1.9 KiB
Python
Executable file
73 lines
1.9 KiB
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import errno
|
|
import sys
|
|
import os
|
|
|
|
from lib.config import PLATFORM, get_target_arch
|
|
from lib.util import add_exec_bit, download, extract_zip, rm_rf, \
|
|
safe_mkdir, tempdir
|
|
|
|
VERSION = 'v1.4.0'
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
FRAMEWORKS_URL = 'http://github.com/electron/electron-frameworks/releases' \
|
|
'/download/' + VERSION
|
|
|
|
|
|
def main():
|
|
os.chdir(SOURCE_ROOT)
|
|
version_file = os.path.join(SOURCE_ROOT, 'external_binaries', '.version')
|
|
|
|
if (is_updated(version_file, VERSION)):
|
|
return
|
|
|
|
rm_rf('external_binaries')
|
|
safe_mkdir('external_binaries')
|
|
|
|
if sys.platform == 'darwin':
|
|
download_and_unzip('Mantle')
|
|
download_and_unzip('ReactiveCocoa')
|
|
download_and_unzip('Squirrel')
|
|
elif sys.platform in ['cygwin', 'win32']:
|
|
download_and_unzip('directxsdk-' + get_target_arch())
|
|
|
|
# get sccache & set exec bit. https://bugs.python.org/issue15795
|
|
download_and_unzip('sccache-{0}-x64'.format(PLATFORM))
|
|
appname = 'sccache'
|
|
if sys.platform == 'win32':
|
|
appname += '.exe'
|
|
add_exec_bit(os.path.join('external_binaries', appname))
|
|
|
|
with open(version_file, 'w') as f:
|
|
f.write(VERSION)
|
|
|
|
|
|
def is_updated(version_file, version):
|
|
existing_version = ''
|
|
try:
|
|
with open(version_file, 'r') as f:
|
|
existing_version = f.readline().strip()
|
|
except IOError as e:
|
|
if e.errno != errno.ENOENT:
|
|
raise
|
|
return existing_version == version
|
|
|
|
|
|
def download_and_unzip(framework):
|
|
zip_path = download_framework(framework)
|
|
if zip_path:
|
|
extract_zip(zip_path, 'external_binaries')
|
|
|
|
|
|
def download_framework(framework):
|
|
filename = framework + '.zip'
|
|
url = FRAMEWORKS_URL + '/' + filename
|
|
download_dir = tempdir(prefix='electron-')
|
|
path = os.path.join(download_dir, filename)
|
|
|
|
download('Download ' + framework, url, path)
|
|
return path
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|