compile-coffee.py searches for node even on non-windows systems
This commit is contained in:
parent
b4403fa9ec
commit
e4415f0021
1 changed files with 19 additions and 10 deletions
|
@ -10,6 +10,11 @@ WINDOWS_NODE_PATHs = [
|
||||||
'C:/Program Files (x86)/nodejs',
|
'C:/Program Files (x86)/nodejs',
|
||||||
'C:/Program Files/nodejs',
|
'C:/Program Files/nodejs',
|
||||||
] + os.environ['PATH'].split(os.pathsep)
|
] + os.environ['PATH'].split(os.pathsep)
|
||||||
|
NIX_NODE_PATHs = [
|
||||||
|
'/usr/local/bin',
|
||||||
|
'/usr/bin',
|
||||||
|
'/bin',
|
||||||
|
] + os.environ['PATH'].split(os.pathsep)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -18,20 +23,24 @@ def main():
|
||||||
|
|
||||||
coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin',
|
coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin',
|
||||||
'coffee')
|
'coffee')
|
||||||
|
|
||||||
|
node = 'node'
|
||||||
if sys.platform in ['win32', 'cygwin']:
|
if sys.platform in ['win32', 'cygwin']:
|
||||||
node = find_node()
|
node = find_node(WINDOWS_NODE_PATHs, 'node.exe')
|
||||||
if not node:
|
|
||||||
print 'Node.js not found in PATH for building atom-shell'
|
|
||||||
return 1
|
|
||||||
subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file],
|
|
||||||
executable=node)
|
|
||||||
else:
|
else:
|
||||||
subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file])
|
node = find_node(NIX_NODE_PATHs, 'node')
|
||||||
|
|
||||||
|
if not node:
|
||||||
|
print 'Node.js not found in PATH for building electron'
|
||||||
|
return 1
|
||||||
|
|
||||||
|
subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file],
|
||||||
|
executable=node)
|
||||||
|
|
||||||
|
|
||||||
def find_node():
|
def find_node(paths, target):
|
||||||
for path in WINDOWS_NODE_PATHs:
|
for path in paths:
|
||||||
full_path = os.path.join(path, 'node.exe')
|
full_path = os.path.join(path, target)
|
||||||
if os.path.exists(full_path):
|
if os.path.exists(full_path):
|
||||||
return full_path
|
return full_path
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue