Use atom.gyp to generate paths in test.py

This commit is contained in:
Cheng Zhao 2015-04-12 22:10:02 +08:00
parent f8d64ef1e4
commit 6ba57dcfa3

View file

@ -4,9 +4,14 @@ import os
import subprocess import subprocess
import sys import sys
from lib.util import atom_gyp
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJECT_NAME = atom_gyp()['project_name%']
PRODUCT_NAME = atom_gyp()['product_name%']
def main(): def main():
os.chdir(SOURCE_ROOT) os.chdir(SOURCE_ROOT)
@ -16,12 +21,14 @@ def main():
config = 'R' config = 'R'
if sys.platform == 'darwin': if sys.platform == 'darwin':
atom_shell = os.path.join(SOURCE_ROOT, 'out', config, 'Atom.app', atom_shell = os.path.join(SOURCE_ROOT, 'out', config,
'Contents', 'MacOS', 'Atom') '{0}.app'.format(PRODUCT_NAME), 'Contents',
'MacOS', PRODUCT_NAME)
elif sys.platform == 'win32': elif sys.platform == 'win32':
atom_shell = os.path.join(SOURCE_ROOT, 'out', config, 'atom.exe') atom_shell = os.path.join(SOURCE_ROOT, 'out', config,
'{0}.exe'.format(PROJECT_NAME))
else: else:
atom_shell = os.path.join(SOURCE_ROOT, 'out', config, 'atom') atom_shell = os.path.join(SOURCE_ROOT, 'out', config, PROJECT_NAME)
subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:]) subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:])