Discard the extra node binary.

We now use atom-shell's binary to execute scripts.
This commit is contained in:
Cheng Zhao 2013-08-08 16:24:27 +08:00
parent 574811fee0
commit 317bd0debf
6 changed files with 1 additions and 117 deletions

1
.gitignore vendored
View file

@ -4,7 +4,6 @@ version
/build/ /build/
/dist/ /dist/
/frameworks/ /frameworks/
/node/
/out/ /out/
/vendor/brightray/vendor/download/ /vendor/brightray/vendor/download/
/vendor/python_26/ /vendor/python_26/

View file

@ -237,13 +237,6 @@
'browser/default_app', 'browser/default_app',
], ],
}, },
{
# Copy node binary for worker process support.
'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Resources',
'files': [
'node/node',
],
},
], ],
'postbuilds': [ 'postbuilds': [
{ {
@ -287,12 +280,6 @@
'browser/default_app', 'browser/default_app',
] ]
}, },
{
'destination': '<(PRODUCT_DIR)/resources',
'files': [
'node/node.exe',
]
},
], ],
}], # OS=="win" }], # OS=="win"
], ],

View file

@ -11,7 +11,6 @@ from lib.util import *
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor') VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
NODE_VERSION = 'v0.10.15'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
PYTHON_26_URL = 'https://chromium.googlesource.com/chromium/deps/python_26' PYTHON_26_URL = 'https://chromium.googlesource.com/chromium/deps/python_26'
@ -22,7 +21,6 @@ def main():
args = parse_args() args = parse_args()
if not args.skip_network: if not args.skip_network:
update_submodules() update_submodules()
update_node()
update_apm() update_apm()
update_node_modules() update_node_modules()
bootstrap_brightray(args.url) bootstrap_brightray(args.url)
@ -53,11 +51,6 @@ def update_submodules():
'--recursive']) '--recursive'])
def update_node():
un = os.path.join('script', 'update-node.py')
subprocess.check_call([sys.executable, un, '--version', NODE_VERSION])
def bootstrap_brightray(url): def bootstrap_brightray(url):
bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap') bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap')
subprocess.check_call([sys.executable, bootstrap, url]) subprocess.check_call([sys.executable, bootstrap, url])

View file

@ -14,10 +14,9 @@ def main():
input_file = sys.argv[1] input_file = sys.argv[1]
output_dir = os.path.dirname(sys.argv[2]) output_dir = os.path.dirname(sys.argv[2])
node = get_node_path()
coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin', coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin',
'coffee') 'coffee')
subprocess.check_call([node, coffee, '-c', '-o', output_dir, input_file]) subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file])
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -87,10 +87,3 @@ def safe_mkdir(path):
except OSError as e: except OSError as e:
if e.errno != errno.EEXIST: if e.errno != errno.EEXIST:
raise raise
def get_node_path():
node = os.path.join(os.path.dirname(__file__), '..', '..', 'node', 'node')
if sys.platform == 'win32' or sys.platform == 'cygwin':
node += '.exe'
return node

View file

@ -1,87 +0,0 @@
#!/usr/bin/env python
import argparse
import errno
import subprocess
import stat
import sys
import os
from lib.util import *
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
NODE_VERSION = 'v0.10.15'
NODE_DIST_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/node/dist'
IS_POSIX = (sys.platform != 'win32') and (sys.platform != 'cygwin')
def main():
os.chdir(SOURCE_ROOT)
args = parse_args()
if not node_needs_update(args.version):
return 0
url, filename = get_node_url(args.url, args.version)
directory = tempdir(prefix='atom-shell-')
node_path = os.path.join(directory, filename)
download('Download node', url, node_path)
if IS_POSIX:
root_name = 'node-{0}-{1}-x86'.format(args.version, sys.platform)
member = os.path.join(root_name, 'bin', 'node')
extract_tarball(node_path, member, directory)
node_path = os.path.join(directory, member)
copy_node(node_path)
def parse_args():
parser = argparse.ArgumentParser(description='Update node binary')
parser.add_argument('--version',
help='Version of node',
default=NODE_VERSION,
required=False)
parser.add_argument('--url',
help='URL to download node',
default=NODE_DIST_URL,
required=False)
return parser.parse_args()
def node_needs_update(target_version):
try:
node = os.path.join('node', 'node')
if not IS_POSIX:
node += '.exe'
version = subprocess.check_output([node, '--version'])
return version.strip() != target_version
except OSError as e:
if e.errno != errno.ENOENT:
raise
return True
def get_node_url(base_url, target_version):
if IS_POSIX:
distname = 'node-{0}-{1}-x86.tar.gz'.format(target_version, sys.platform)
else:
distname = 'node.exe'
return '{0}/{1}/{2}'.format(base_url, target_version, distname), distname
def copy_node(node_path):
safe_mkdir('node')
node = os.path.join('node', 'node')
if not IS_POSIX:
node += '.exe'
safe_unlink(node)
os.rename(node_path, node)
st = os.stat(node)
os.chmod(node, st.st_mode | stat.S_IEXEC)
if __name__ == '__main__':
sys.exit(main())