зеркало из https://github.com/electron/electron.git
Add script to make distribution and upload.
The scripts are stolen from aroben/libchromiumcontent.
This commit is contained in:
Родитель
ebac5f9ed5
Коммит
3290c05e75
|
@ -1,5 +1,7 @@
|
|||
.DS_Store
|
||||
atom-shell.zip
|
||||
build/
|
||||
dist/
|
||||
node/
|
||||
node_modules/
|
||||
vendor/
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import errno
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
|
||||
BUNDLE_NAME = 'Atom.app'
|
||||
BUNDLE_DIR = os.path.join(SOURCE_ROOT, 'build', 'Release', BUNDLE_NAME)
|
||||
|
||||
|
||||
def main():
|
||||
rm_rf(DIST_DIR)
|
||||
os.makedirs(DIST_DIR)
|
||||
|
||||
copy_binaries()
|
||||
create_zip()
|
||||
|
||||
|
||||
def copy_binaries():
|
||||
shutil.copytree(BUNDLE_DIR, os.path.join(DIST_DIR, BUNDLE_NAME))
|
||||
|
||||
|
||||
def create_zip():
|
||||
print "Zipping distribution..."
|
||||
zip_file = os.path.join(SOURCE_ROOT, 'atom-shell.zip')
|
||||
safe_unlink(zip_file)
|
||||
shutil.make_archive(os.path.splitext(zip_file)[0], 'zip',
|
||||
root_dir=DIST_DIR)
|
||||
|
||||
|
||||
def rm_rf(path):
|
||||
try:
|
||||
shutil.rmtree(path)
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
|
||||
|
||||
def safe_unlink(path):
|
||||
try:
|
||||
os.unlink(path)
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
sys.exit(main())
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import errno
|
||||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
ensure_s3put()
|
||||
upload()
|
||||
except AssertionError as e:
|
||||
return e.message
|
||||
|
||||
|
||||
def ensure_s3put():
|
||||
output = ''
|
||||
try:
|
||||
output = subprocess.check_output(['s3put', '--help'])
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
assert 'multipart' in output, 'Error: Please install boto and filechunkio'
|
||||
|
||||
|
||||
def upload():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
bucket, access_key, secret_key = s3_config()
|
||||
commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
|
||||
|
||||
args = [
|
||||
's3put',
|
||||
'--bucket', bucket,
|
||||
'--access_key', access_key,
|
||||
'--secret_key', secret_key,
|
||||
'--prefix', SOURCE_ROOT,
|
||||
'--key_prefix', 'atom-shell/{0}'.format(commit),
|
||||
'--grant', 'public-read'
|
||||
] + glob.glob('atom-shell*.zip')
|
||||
|
||||
subprocess.check_call(args)
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
sys.exit(main())
|
Загрузка…
Ссылка в новой задаче