diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/flatbufferjs_hack.py | 33 | ||||
-rwxr-xr-x | js/run_node.py | 40 |
2 files changed, 0 insertions, 73 deletions
diff --git a/js/flatbufferjs_hack.py b/js/flatbufferjs_hack.py deleted file mode 100755 index 2f411c1db..000000000 --- a/js/flatbufferjs_hack.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python -""" -gn can only run python scripts. - -Generates flatbuffer TypeScript code. -""" -import subprocess -import sys -import os -import shutil - -# TODO(ry) Ideally flatc output files should be written into target_gen_dir, but -# its difficult to get this working in a way that parcel can resolve their -# location. (Parcel does not support NODE_PATH.) Therefore this hack: write the -# generated msg_generated.ts outputs into the js/ folder, and we check them into -# the repo. Hopefully this hack can be removed at some point. If msg.fps is -# changed, commit changes to the generated JS file. - -src = sys.argv[1] -dst = sys.argv[2] -stamp_file = sys.argv[3] - -shutil.copyfile(src, dst) - - -def touch(fname): - if os.path.exists(fname): - os.utime(fname, None) - else: - open(fname, 'a').close() - - -touch(stamp_file) diff --git a/js/run_node.py b/js/run_node.py deleted file mode 100755 index 154c2167b..000000000 --- a/js/run_node.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -""" -gn can only run python scripts. This launches a subprocess Node process. -The working dir of this program is out/Debug/ (AKA root_build_dir) -Before running node, we symlink js/node_modules to out/Debug/node_modules. -""" -import subprocess -import sys -import os - - -def symlink(target, name, target_is_dir=False): - if os.name == "nt": - import ctypes - CreateSymbolicLinkW = ctypes.windll.kernel32.CreateSymbolicLinkW - CreateSymbolicLinkW.restype = ctypes.c_ubyte - CreateSymbolicLinkW.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, - ctypes.c_uint32) - - flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE - if (target_is_dir): - flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY - if not CreateSymbolicLinkW(name, target, flags): - raise ctypes.WinError() - else: - os.symlink(target, name) - - -root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -third_party_path = os.path.join(root_path, "third_party") -target_abs = os.path.join(third_party_path, "node_modules") -target_rel = os.path.relpath(target_abs) - -if not os.path.exists("node_modules"): - if os.path.lexists("node_modules"): - os.unlink("node_modules") - symlink(target_rel, "node_modules", True) - -args = ["node"] + sys.argv[1:] -sys.exit(subprocess.call(args)) |