Fixes #1408.
Closes #1359.
'variables': {
'project_name%': 'atom',
'product_name%': 'Atom',
+ 'version%': '0.22.3',
'atom_source_root': '<!(["python", "tools/atom_source_root.py"])',
},
{
"name": "atom-shell",
- "version": "0.22.3",
- "licenses": [
- {
- "type": "MIT",
- "url": "http://github.com/atom/atom-shell/raw/master/LICENSE.md"
- }
- ],
"devDependencies": {
"asar": "0.2.2",
- "atom-package-manager": "0.144.0",
"coffee-script": "~1.7.1",
"coffeelint": "~1.3.0",
"request": "*",
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \
enable_verbose_mode, is_verbose_mode, get_target_arch
-from lib.util import execute_stdout, scoped_cwd
+from lib.util import execute_stdout, get_atom_shell_version, scoped_cwd
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
create_chrome_version_h()
touch_config_gypi()
update_atom_shell()
- update_atom_modules('spec')
+ update_atom_modules('spec', args.target_arch)
def parse_args():
execute_stdout([sys.executable, bootstrap] + args)
-def update_node_modules(dirname):
+def update_node_modules(dirname, env=os.environ):
with scoped_cwd(dirname):
if is_verbose_mode():
- execute_stdout([NPM, 'install', '--verbose'])
+ execute_stdout([NPM, 'install', '--verbose'], env)
else:
- execute_stdout([NPM, 'install'])
+ execute_stdout([NPM, 'install'], env)
-def update_atom_modules(dirname):
- with scoped_cwd(dirname):
- apm = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'apm')
- if sys.platform in ['win32', 'cygwin']:
- apm = os.path.join(SOURCE_ROOT, 'node_modules', 'atom-package-manager',
- 'bin', 'apm.cmd')
- execute_stdout([apm, 'install'])
+def update_atom_modules(dirname, target_arch):
+ env = os.environ.copy()
+ env['npm_config_arch'] = target_arch
+ env['npm_config_target'] = get_atom_shell_version()
+ env['npm_config_disturl'] = 'https://atom.io/download/atom-shell'
+ update_node_modules(dirname, env)
def update_win32_python():
version = '.'.join(versions[:3])
with scoped_cwd(SOURCE_ROOT):
- update_package_json(version)
+ update_atom_gyp(version)
update_win_rc(version, versions)
update_version_h(versions)
update_info_plist(version)
return versions
-def update_package_json(version):
- pattern = re.compile(' *"version" *: *"[0-9.]+"')
- with open('package.json', 'r') as f:
+def update_atom_gyp(version):
+ pattern = re.compile(" *'version%' *: *'[0-9.]+'")
+ with open('atom.gyp', 'r') as f:
lines = f.readlines()
for i in range(0, len(lines)):
if pattern.match(lines[i]):
- lines[i] = ' "version": "{0}",\n'.format(version)
- with open('package.json', 'w') as f:
+ lines[i] = " 'version%': '{0}',\n".format(version)
+ with open('atom.gyp', 'w') as f:
f.write(''.join(lines))
return
import sys
from lib.config import PLATFORM
-from lib.util import execute, rm_rf
+from lib.util import atom_gyp, execute, rm_rf
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def get_names_from_gyp():
- gyp = os.path.join(SOURCE_ROOT, 'atom.gyp')
- with open(gyp) as f:
- o = eval(f.read());
- return (o['variables']['project_name%'], o['variables']['product_name%'])
+ variables = atom_gyp()
+ return (variables['project_name%'], variables['product_name%'])
if __name__ == '__main__':
raise
-def execute(argv):
+def execute(argv, env=os.environ):
if is_verbose_mode():
print ' '.join(argv)
try:
- output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
+ output = subprocess.check_output(argv, stderr=subprocess.STDOUT, env=env)
if is_verbose_mode():
print output
return output
raise e
-def execute_stdout(argv):
+def execute_stdout(argv, env=os.environ):
if is_verbose_mode():
print ' '.join(argv)
try:
- subprocess.check_call(argv)
+ subprocess.check_call(argv, env=env)
except subprocess.CalledProcessError as e:
print e.output
raise e
else:
- execute(argv)
+ execute(argv, env)
+
+
+def atom_gyp():
+ SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
+ gyp = os.path.join(SOURCE_ROOT, 'atom.gyp')
+ with open(gyp) as f:
+ obj = eval(f.read());
+ return obj['variables']
def get_atom_shell_version():
- return subprocess.check_output(['git', 'describe', '--tags']).strip()
+ return atom_gyp()['version%']
def get_chromedriver_version():