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__))
|
|
|
|
|
|
|
|
|
|
|
|
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 19:41:11 +00:00
|
|
|
print 'Node.js not found in PATH for building atom-shell'
|
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():
|
2014-11-25 19:41:11 +00:00
|
|
|
PATHs = os.environ['PATH'].split(os.pathsep)
|
|
|
|
for path in PATHs:
|
|
|
|
full_path = os.path.join(path, 'node.exe')
|
|
|
|
if os.path.exists(full_path):
|
|
|
|
return full_path
|
2013-12-17 05:14:54 +00:00
|
|
|
return None
|
|
|
|
|
|
|
|
|
2013-06-24 08:24:19 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|