Move the code of uploading node headers to the new script
This commit is contained in:
parent
68cfe80369
commit
241e410a07
2 changed files with 56 additions and 53 deletions
|
@ -1,17 +1,20 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
from lib.util import safe_mkdir, scoped_cwd
|
from lib.config import TARGET_PLATFORM
|
||||||
|
from lib.util import execute, safe_mkdir, scoped_cwd, s3_config, s3put
|
||||||
|
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
|
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
|
||||||
NODE_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'node')
|
NODE_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'node')
|
||||||
|
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'Release')
|
||||||
|
|
||||||
HEADERS_SUFFIX = [
|
HEADERS_SUFFIX = [
|
||||||
'.h',
|
'.h',
|
||||||
|
@ -36,9 +39,19 @@ def main():
|
||||||
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
dist_headers_dir = os.path.join(DIST_DIR, 'node-{0}'.format(args.version))
|
dist_headers_dir = os.path.join(DIST_DIR, 'node-{0}'.format(args.version))
|
||||||
|
|
||||||
copy_headers(dist_headers_dir)
|
copy_headers(dist_headers_dir)
|
||||||
create_header_tarball(dist_headers_dir)
|
create_header_tarball(dist_headers_dir)
|
||||||
|
|
||||||
|
# Upload node's headers to S3.
|
||||||
|
bucket, access_key, secret_key = s3_config()
|
||||||
|
upload_node(bucket, access_key, secret_key, args.version)
|
||||||
|
|
||||||
|
# Upload the SHASUMS.txt.
|
||||||
|
execute([sys.executable,
|
||||||
|
os.path.join(SOURCE_ROOT, 'script', 'upload-checksums.py'),
|
||||||
|
'-v', args.version])
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
parser = argparse.ArgumentParser(description='upload sumsha file')
|
parser = argparse.ArgumentParser(description='upload sumsha file')
|
||||||
|
@ -91,5 +104,44 @@ def copy_source_file(source, start, destination):
|
||||||
shutil.copy2(source, final_destination)
|
shutil.copy2(source, final_destination)
|
||||||
|
|
||||||
|
|
||||||
|
def upload_node(bucket, access_key, secret_key, version):
|
||||||
|
os.chdir(DIST_DIR)
|
||||||
|
|
||||||
|
s3put(bucket, access_key, secret_key, DIST_DIR,
|
||||||
|
'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz'))
|
||||||
|
|
||||||
|
if TARGET_PLATFORM == 'win32':
|
||||||
|
# Generate the node.lib.
|
||||||
|
build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
|
||||||
|
execute([sys.executable, build, '-c', 'Release', '-t', 'generate_node_lib'])
|
||||||
|
|
||||||
|
# Upload the 32bit node.lib.
|
||||||
|
node_lib = os.path.join(OUT_DIR, 'node.lib')
|
||||||
|
s3put(bucket, access_key, secret_key, OUT_DIR,
|
||||||
|
'atom-shell/dist/{0}'.format(version), [node_lib])
|
||||||
|
|
||||||
|
# Upload the fake 64bit node.lib.
|
||||||
|
touch_x64_node_lib()
|
||||||
|
node_lib = os.path.join(OUT_DIR, 'x64', 'node.lib')
|
||||||
|
s3put(bucket, access_key, secret_key, OUT_DIR,
|
||||||
|
'atom-shell/dist/{0}'.format(version), [node_lib])
|
||||||
|
|
||||||
|
# Upload the index.json
|
||||||
|
atom_shell = os.path.join(OUT_DIR, 'atom.exe')
|
||||||
|
index_json = os.path.join(OUT_DIR, 'index.json')
|
||||||
|
execute([atom_shell,
|
||||||
|
os.path.join(SOURCE_ROOT, 'script', 'dump-version-info.js'),
|
||||||
|
index_json])
|
||||||
|
s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist',
|
||||||
|
[index_json])
|
||||||
|
|
||||||
|
|
||||||
|
def touch_x64_node_lib():
|
||||||
|
x64_dir = os.path.join(OUT_DIR, 'x64')
|
||||||
|
safe_mkdir(x64_dir)
|
||||||
|
with open(os.path.join(x64_dir, 'node.lib'), 'w+') as node_lib:
|
||||||
|
node_lib.write('Invalid library')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
|
@ -10,8 +10,7 @@ import tempfile
|
||||||
|
|
||||||
from lib.config import DIST_ARCH, TARGET_PLATFORM
|
from lib.config import DIST_ARCH, TARGET_PLATFORM
|
||||||
from lib.util import execute, get_atom_shell_version, parse_version, \
|
from lib.util import execute, get_atom_shell_version, parse_version, \
|
||||||
get_chromedriver_version, scoped_cwd, safe_mkdir, \
|
get_chromedriver_version, scoped_cwd
|
||||||
s3_config, s3put
|
|
||||||
from lib.github import GitHub
|
from lib.github import GitHub
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,15 +59,6 @@ def main():
|
||||||
os.path.join(DIST_DIR, CHROMEDRIVER_NAME))
|
os.path.join(DIST_DIR, CHROMEDRIVER_NAME))
|
||||||
|
|
||||||
if args.publish_release:
|
if args.publish_release:
|
||||||
# Upload node's headers to S3.
|
|
||||||
bucket, access_key, secret_key = s3_config()
|
|
||||||
upload_node(bucket, access_key, secret_key, ATOM_SHELL_VERSION)
|
|
||||||
|
|
||||||
# Upload the SHASUMS.txt.
|
|
||||||
execute([sys.executable,
|
|
||||||
os.path.join(SOURCE_ROOT, 'script', 'upload-checksums.py'),
|
|
||||||
'-v', ATOM_SHELL_VERSION])
|
|
||||||
|
|
||||||
# Upload PDBs to Windows symbol server.
|
# Upload PDBs to Windows symbol server.
|
||||||
if TARGET_PLATFORM == 'win32':
|
if TARGET_PLATFORM == 'win32':
|
||||||
execute([sys.executable,
|
execute([sys.executable,
|
||||||
|
@ -168,38 +158,6 @@ def publish_release(github, release_id):
|
||||||
github.repos(ATOM_SHELL_REPO).releases(release_id).patch(data=data)
|
github.repos(ATOM_SHELL_REPO).releases(release_id).patch(data=data)
|
||||||
|
|
||||||
|
|
||||||
def upload_node(bucket, access_key, secret_key, version):
|
|
||||||
os.chdir(DIST_DIR)
|
|
||||||
|
|
||||||
s3put(bucket, access_key, secret_key, DIST_DIR,
|
|
||||||
'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz'))
|
|
||||||
|
|
||||||
if TARGET_PLATFORM == 'win32':
|
|
||||||
# Generate the node.lib.
|
|
||||||
build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
|
|
||||||
execute([sys.executable, build, '-c', 'Release', '-t', 'generate_node_lib'])
|
|
||||||
|
|
||||||
# Upload the 32bit node.lib.
|
|
||||||
node_lib = os.path.join(OUT_DIR, 'node.lib')
|
|
||||||
s3put(bucket, access_key, secret_key, OUT_DIR,
|
|
||||||
'atom-shell/dist/{0}'.format(version), [node_lib])
|
|
||||||
|
|
||||||
# Upload the fake 64bit node.lib.
|
|
||||||
touch_x64_node_lib()
|
|
||||||
node_lib = os.path.join(OUT_DIR, 'x64', 'node.lib')
|
|
||||||
s3put(bucket, access_key, secret_key, OUT_DIR,
|
|
||||||
'atom-shell/dist/{0}'.format(version), [node_lib])
|
|
||||||
|
|
||||||
# Upload the index.json
|
|
||||||
atom_shell = os.path.join(OUT_DIR, 'atom.exe')
|
|
||||||
index_json = os.path.join(OUT_DIR, 'index.json')
|
|
||||||
execute([atom_shell,
|
|
||||||
os.path.join(SOURCE_ROOT, 'script', 'dump-version-info.js'),
|
|
||||||
index_json])
|
|
||||||
s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist',
|
|
||||||
[index_json])
|
|
||||||
|
|
||||||
|
|
||||||
def auth_token():
|
def auth_token():
|
||||||
token = os.environ.get('ATOM_SHELL_GITHUB_TOKEN')
|
token = os.environ.get('ATOM_SHELL_GITHUB_TOKEN')
|
||||||
message = ('Error: Please set the $ATOM_SHELL_GITHUB_TOKEN '
|
message = ('Error: Please set the $ATOM_SHELL_GITHUB_TOKEN '
|
||||||
|
@ -208,13 +166,6 @@ def auth_token():
|
||||||
return token
|
return token
|
||||||
|
|
||||||
|
|
||||||
def touch_x64_node_lib():
|
|
||||||
x64_dir = os.path.join(OUT_DIR, 'x64')
|
|
||||||
safe_mkdir(x64_dir)
|
|
||||||
with open(os.path.join(x64_dir, 'node.lib'), 'w+') as node_lib:
|
|
||||||
node_lib.write('Invalid library')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
Loading…
Reference in a new issue