commit
761aa0e95c
2 changed files with 19 additions and 4 deletions
|
@ -1,15 +1,16 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import contextlib
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
natives = sys.argv[1]
|
natives = os.path.abspath(sys.argv[1])
|
||||||
coffee_source_files = sys.argv[2:]
|
coffee_source_files = sys.argv[2:]
|
||||||
|
|
||||||
output_dir = os.path.dirname(natives)
|
output_dir = os.path.dirname(natives)
|
||||||
|
@ -35,7 +36,21 @@ def call_compile_coffee(source_file, output_filename):
|
||||||
|
|
||||||
def call_js2c(natives, js_source_files):
|
def call_js2c(natives, js_source_files):
|
||||||
js2c = os.path.join(SOURCE_ROOT, 'vendor', 'node', 'tools', 'js2c.py')
|
js2c = os.path.join(SOURCE_ROOT, 'vendor', 'node', 'tools', 'js2c.py')
|
||||||
subprocess.check_call([sys.executable, js2c, natives] + js_source_files)
|
src_dir = os.path.dirname(js_source_files[0])
|
||||||
|
with scoped_cwd(src_dir):
|
||||||
|
subprocess.check_call(
|
||||||
|
[sys.executable, js2c, natives] +
|
||||||
|
[os.path.basename(source) for source in js_source_files])
|
||||||
|
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def scoped_cwd(path):
|
||||||
|
cwd = os.getcwd()
|
||||||
|
os.chdir(path)
|
||||||
|
try:
|
||||||
|
yield
|
||||||
|
finally:
|
||||||
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
2
vendor/node
vendored
2
vendor/node
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 9140160f9d3792dfd0f1de13a9781e28a9dc4d3c
|
Subproject commit 6479eb98d5b3d9d25a86eff857af17dcc61f3bc4
|
Loading…
Reference in a new issue