TARGET_PLATFORM => PLATFORM

TARGET_PLATFORM is quite misleading since it is actually host platform.
This commit is contained in:
Cheng Zhao 2015-04-11 17:30:52 +08:00
parent ca50cbb5ff
commit 1a6832d849
6 changed files with 29 additions and 29 deletions

View file

@ -4,7 +4,7 @@ import argparse
import os import os
import sys import sys
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, TARGET_PLATFORM, \ from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \
enable_verbose_mode, is_verbose_mode enable_verbose_mode, is_verbose_mode
from lib.util import execute_stdout, scoped_cwd from lib.util import execute_stdout, scoped_cwd
@ -19,7 +19,7 @@ def main():
os.chdir(SOURCE_ROOT) os.chdir(SOURCE_ROOT)
args = parse_args() args = parse_args()
if not args.yes and TARGET_PLATFORM != 'win32': if not args.yes and PLATFORM != 'win32':
check_root() check_root()
if args.verbose: if args.verbose:
enable_verbose_mode() enable_verbose_mode()

View file

@ -7,7 +7,7 @@ import subprocess
import sys import sys
import stat import stat
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, TARGET_PLATFORM, \ from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \
DIST_ARCH DIST_ARCH
from lib.util import scoped_cwd, rm_rf, get_atom_shell_version, make_zip, \ from lib.util import scoped_cwd, rm_rf, get_atom_shell_version, make_zip, \
execute, get_chromedriver_version execute, get_chromedriver_version
@ -79,7 +79,7 @@ def main():
copy_chromedriver() copy_chromedriver()
copy_license() copy_license()
if TARGET_PLATFORM == 'linux': if PLATFORM == 'linux':
strip_binaries() strip_binaries()
copy_system_libraries() copy_system_libraries()
@ -95,17 +95,17 @@ def force_build():
def copy_binaries(): def copy_binaries():
for binary in TARGET_BINARIES[TARGET_PLATFORM]: for binary in TARGET_BINARIES[PLATFORM]:
shutil.copy2(os.path.join(OUT_DIR, binary), DIST_DIR) shutil.copy2(os.path.join(OUT_DIR, binary), DIST_DIR)
for directory in TARGET_DIRECTORIES[TARGET_PLATFORM]: for directory in TARGET_DIRECTORIES[PLATFORM]:
shutil.copytree(os.path.join(OUT_DIR, directory), shutil.copytree(os.path.join(OUT_DIR, directory),
os.path.join(DIST_DIR, directory), os.path.join(DIST_DIR, directory),
symlinks=True) symlinks=True)
def copy_chromedriver(): def copy_chromedriver():
if TARGET_PLATFORM == 'win32': if PLATFORM == 'win32':
chromedriver = 'chromedriver.exe' chromedriver = 'chromedriver.exe'
else: else:
chromedriver = 'chromedriver' chromedriver = 'chromedriver'
@ -122,7 +122,7 @@ def copy_license():
def strip_binaries(): def strip_binaries():
for binary in TARGET_BINARIES[TARGET_PLATFORM]: for binary in TARGET_BINARIES[PLATFORM]:
if binary.endswith('.so') or '.' not in binary: if binary.endswith('.so') or '.' not in binary:
execute(['strip', os.path.join(DIST_DIR, binary)]) execute(['strip', os.path.join(DIST_DIR, binary)])
@ -155,25 +155,25 @@ def create_symbols():
def create_dist_zip(): def create_dist_zip():
dist_name = 'atom-shell-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION, dist_name = 'atom-shell-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION,
TARGET_PLATFORM, DIST_ARCH) PLATFORM, DIST_ARCH)
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
with scoped_cwd(DIST_DIR): with scoped_cwd(DIST_DIR):
files = TARGET_BINARIES[TARGET_PLATFORM] + ['LICENSE', 'version'] files = TARGET_BINARIES[PLATFORM] + ['LICENSE', 'version']
if TARGET_PLATFORM == 'linux': if PLATFORM == 'linux':
files += [lib for lib in SYSTEM_LIBRARIES if os.path.exists(lib)] files += [lib for lib in SYSTEM_LIBRARIES if os.path.exists(lib)]
dirs = TARGET_DIRECTORIES[TARGET_PLATFORM] dirs = TARGET_DIRECTORIES[PLATFORM]
make_zip(zip_file, files, dirs) make_zip(zip_file, files, dirs)
def create_chromedriver_zip(): def create_chromedriver_zip():
dist_name = 'chromedriver-{0}-{1}-{2}.zip'.format(get_chromedriver_version(), dist_name = 'chromedriver-{0}-{1}-{2}.zip'.format(get_chromedriver_version(),
TARGET_PLATFORM, DIST_ARCH) PLATFORM, DIST_ARCH)
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
with scoped_cwd(DIST_DIR): with scoped_cwd(DIST_DIR):
files = ['LICENSE'] files = ['LICENSE']
if TARGET_PLATFORM == 'win32': if PLATFORM == 'win32':
files += ['chromedriver.exe'] files += ['chromedriver.exe']
else: else:
files += ['chromedriver'] files += ['chromedriver']
@ -182,7 +182,7 @@ def create_chromedriver_zip():
def create_symbols_zip(): def create_symbols_zip():
dist_name = 'atom-shell-{0}-{1}-{2}-symbols.zip'.format(ATOM_SHELL_VERSION, dist_name = 'atom-shell-{0}-{1}-{2}-symbols.zip'.format(ATOM_SHELL_VERSION,
TARGET_PLATFORM, PLATFORM,
DIST_ARCH) DIST_ARCH)
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

View file

@ -3,7 +3,7 @@
import os import os
import sys import sys
from lib.config import TARGET_PLATFORM from lib.config import PLATFORM
from lib.util import execute, rm_rf from lib.util import execute, rm_rf
@ -15,20 +15,20 @@ CHROMIUM_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor',
def main(destination): def main(destination):
if TARGET_PLATFORM == 'win32': if PLATFORM == 'win32':
register_required_dll() register_required_dll()
rm_rf(destination) rm_rf(destination)
(project_name, product_name) = get_names_from_gyp() (project_name, product_name) = get_names_from_gyp()
if TARGET_PLATFORM in ['darwin', 'linux']: if PLATFORM in ['darwin', 'linux']:
# Generate the dump_syms tool. # Generate the dump_syms tool.
build = os.path.join(SOURCE_ROOT, 'script', 'build.py') build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
execute([sys.executable, build, '-c', 'R', '-t', 'dump_syms']) execute([sys.executable, build, '-c', 'R', '-t', 'dump_syms'])
generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'posix', generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'posix',
'generate_breakpad_symbols.py') 'generate_breakpad_symbols.py')
if TARGET_PLATFORM == 'darwin': if PLATFORM == 'darwin':
start = os.path.join(OUT_DIR, '{0}.app'.format(product_name), 'Contents', start = os.path.join(OUT_DIR, '{0}.app'.format(product_name), 'Contents',
'MacOS', product_name) 'MacOS', product_name)
else: else:

View file

@ -17,7 +17,7 @@ DIST_ARCH = {
'64bit': 'x64', '64bit': 'x64',
}[ARCH] }[ARCH]
TARGET_PLATFORM = { PLATFORM = {
'cygwin': 'win32', 'cygwin': 'win32',
'darwin': 'darwin', 'darwin': 'darwin',
'linux2': 'linux', 'linux2': 'linux',

View file

@ -7,7 +7,7 @@ import shutil
import sys import sys
import tarfile import tarfile
from lib.config import TARGET_PLATFORM from lib.config import PLATFORM
from lib.util import execute, safe_mkdir, scoped_cwd, s3_config, s3put from lib.util import execute, safe_mkdir, scoped_cwd, s3_config, s3put
@ -109,7 +109,7 @@ def upload_node(bucket, access_key, secret_key, version):
s3put(bucket, access_key, secret_key, DIST_DIR, s3put(bucket, access_key, secret_key, DIST_DIR,
'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz')) 'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz'))
if TARGET_PLATFORM == 'win32': if PLATFORM == 'win32':
# Copy atom.lib to node.lib # Copy atom.lib to node.lib
node_lib = os.path.join(OUT_DIR, 'node.lib') node_lib = os.path.join(OUT_DIR, 'node.lib')
atom_lib = os.path.join(OUT_DIR, 'node.dll.lib') atom_lib = os.path.join(OUT_DIR, 'node.dll.lib')

View file

@ -7,7 +7,7 @@ import subprocess
import sys import sys
import tempfile import tempfile
from lib.config import DIST_ARCH, TARGET_PLATFORM from lib.config import DIST_ARCH, 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 get_chromedriver_version, scoped_cwd
from lib.github import GitHub from lib.github import GitHub
@ -21,13 +21,13 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R') OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist') DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
DIST_NAME = 'atom-shell-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION, DIST_NAME = 'atom-shell-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION,
TARGET_PLATFORM, PLATFORM,
DIST_ARCH) DIST_ARCH)
SYMBOLS_NAME = 'atom-shell-{0}-{1}-{2}-symbols.zip'.format(ATOM_SHELL_VERSION, SYMBOLS_NAME = 'atom-shell-{0}-{1}-{2}-symbols.zip'.format(ATOM_SHELL_VERSION,
TARGET_PLATFORM, PLATFORM,
DIST_ARCH) DIST_ARCH)
CHROMEDRIVER_NAME = 'chromedriver-{0}-{1}-{2}.zip'.format(CHROMEDRIVER_VERSION, CHROMEDRIVER_NAME = 'chromedriver-{0}-{1}-{2}.zip'.format(CHROMEDRIVER_VERSION,
TARGET_PLATFORM, PLATFORM,
DIST_ARCH) DIST_ARCH)
@ -58,7 +58,7 @@ def main():
os.path.join(DIST_DIR, CHROMEDRIVER_NAME)) os.path.join(DIST_DIR, CHROMEDRIVER_NAME))
if args.publish_release: if args.publish_release:
if TARGET_PLATFORM == 'win32': if PLATFORM == 'win32':
# Upload PDBs to Windows symbol server. # Upload PDBs to Windows symbol server.
execute([sys.executable, execute([sys.executable,
os.path.join(SOURCE_ROOT, 'script', 'upload-windows-pdb.py')]) os.path.join(SOURCE_ROOT, 'script', 'upload-windows-pdb.py')])
@ -83,10 +83,10 @@ def parse_args():
def get_atom_shell_build_version(): def get_atom_shell_build_version():
if TARGET_PLATFORM == 'darwin': if PLATFORM == 'darwin':
atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R', 'Atom.app', atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R', 'Atom.app',
'Contents', 'MacOS', 'Atom') 'Contents', 'MacOS', 'Atom')
elif TARGET_PLATFORM == 'win32': elif PLATFORM == 'win32':
atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R', 'atom.exe') atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R', 'atom.exe')
else: else:
atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R', 'atom') atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R', 'atom')