Rewrite update-frameworks script in python.
This commit is contained in:
parent
9bcb677012
commit
2f50102b50
4 changed files with 50 additions and 26 deletions
41
script/update-frameworks.py
Executable file
41
script/update-frameworks.py
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
from lib.util import *
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
||||
FRAMEWORKS_URL='https://gh-contractor-zcbenz.s3.amazonaws.com/frameworks'
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
safe_mkdir('frameworks')
|
||||
download_and_unzip('Quincy')
|
||||
download_and_unzip('Sparkle')
|
||||
|
||||
|
||||
def download_and_unzip(framework):
|
||||
zip_path = download_framework(framework)
|
||||
if zip_path:
|
||||
extract_zip(zip_path, 'frameworks')
|
||||
|
||||
|
||||
def download_framework(framework):
|
||||
framework_path = os.path.join('frameworks', framework) + '.framework'
|
||||
if os.path.exists(framework_path):
|
||||
return
|
||||
|
||||
filename = framework + '.framework.zip'
|
||||
url = FRAMEWORKS_URL + '/' + filename
|
||||
download_dir = tempdir(prefix='atom-shell-')
|
||||
path = os.path.join(download_dir, filename)
|
||||
|
||||
download('Download ' + framework, url, path)
|
||||
return path
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
Loading…
Add table
Add a link
Reference in a new issue