2013-06-24 08:24:19 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
2013-12-17 05:14:54 +00:00
|
|
|
WINDOWS_NODE_PATHs = [
|
|
|
|
'C:/Program Files/nodejs/node.exe',
|
|
|
|
'C:/Program Files (x86)/nodejs/node.exe',
|
2014-11-25 18:27:31 +00:00
|
|
|
'C:/nodejs/node.exe',
|
2013-12-17 05:14:54 +00:00
|
|
|
]
|
2013-06-24 08:24:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
input_file = sys.argv[1]
|
|
|
|
output_dir = os.path.dirname(sys.argv[2])
|
|
|
|
|
2013-07-01 10:04:15 +00:00
|
|
|
coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin',
|
|
|
|
'coffee')
|
2013-08-16 08:28:45 +00:00
|
|
|
if sys.platform in ['win32', 'cygwin']:
|
2013-12-17 05:14:54 +00:00
|
|
|
node = find_node()
|
|
|
|
if not node:
|
2014-11-25 18:27:31 +00:00
|
|
|
print 'Node.js is required for building atom-shell at paths:\n' + '\n'.join(WINDOWS_NODE_PATHs)
|
2013-12-17 05:14:54 +00:00
|
|
|
return 1
|
2013-08-16 08:28:45 +00:00
|
|
|
subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file],
|
2013-12-17 05:14:54 +00:00
|
|
|
executable=node)
|
2013-08-16 08:28:45 +00:00
|
|
|
else:
|
|
|
|
subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file])
|
2013-06-24 08:24:19 +00:00
|
|
|
|
2013-09-27 02:21:27 +00:00
|
|
|
|
2013-12-17 05:14:54 +00:00
|
|
|
def find_node():
|
|
|
|
for path in WINDOWS_NODE_PATHs:
|
|
|
|
if os.path.exists(path):
|
|
|
|
return path
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
2013-06-24 08:24:19 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|