Check for version when downloading external binaries.
This commit is contained in:
parent
9754050598
commit
c1e2348695
2 changed files with 22 additions and 9 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,7 +1,7 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build/
|
/build/
|
||||||
/dist/
|
/dist/
|
||||||
/frameworks/
|
/external_binaries/
|
||||||
/out/
|
/out/
|
||||||
/vendor/brightray/vendor/download/
|
/vendor/brightray/vendor/download/
|
||||||
/vendor/python_26/
|
/vendor/python_26/
|
||||||
|
|
|
@ -7,21 +7,23 @@ import os
|
||||||
from lib.util import safe_mkdir, extract_zip, tempdir, download
|
from lib.util import safe_mkdir, extract_zip, tempdir, download
|
||||||
|
|
||||||
|
|
||||||
|
VERSION = 'v0.0.3'
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
FRAMEWORKS_URL = 'https://github.com/atom/atom-shell-frameworks/releases' \
|
FRAMEWORKS_URL = 'https://github.com/atom/atom-shell-frameworks/releases' \
|
||||||
'/download/v0.0.3'
|
'/download/' + VERSION
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
os.chdir(SOURCE_ROOT)
|
os.chdir(SOURCE_ROOT)
|
||||||
try:
|
version_file = os.path.join(SOURCE_ROOT, 'external_binaries', '.version')
|
||||||
os.makedirs('external_binaries')
|
|
||||||
except OSError as e:
|
safe_mkdir('external_binaries')
|
||||||
if e.errno != errno.EEXIST:
|
if (is_updated(version_file, VERSION)):
|
||||||
raise
|
|
||||||
else:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
with open(version_file, 'w') as f:
|
||||||
|
f.write(VERSION)
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
download_and_unzip('Mantle')
|
download_and_unzip('Mantle')
|
||||||
download_and_unzip('ReactiveCocoa')
|
download_and_unzip('ReactiveCocoa')
|
||||||
|
@ -30,6 +32,17 @@ def main():
|
||||||
download_and_unzip('directxsdk')
|
download_and_unzip('directxsdk')
|
||||||
|
|
||||||
|
|
||||||
|
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):
|
def download_and_unzip(framework):
|
||||||
zip_path = download_framework(framework)
|
zip_path = download_framework(framework)
|
||||||
if zip_path:
|
if zip_path:
|
||||||
|
|
Loading…
Reference in a new issue