depot/third_party/nixpkgs/pkgs/development/python-modules/kaldi-active-grammar/0002-exec-path.patch

35 lines
1.6 KiB
Diff
Raw Normal View History

diff --git a/kaldi_active_grammar/utils.py b/kaldi_active_grammar/utils.py
index 0b70c7f..21e1d62 100644
--- a/kaldi_active_grammar/utils.py
+++ b/kaldi_active_grammar/utils.py
@@ -79,7 +79,7 @@ elif sys.platform.startswith('linux'): platform = 'linux'
elif sys.platform.startswith('darwin'): platform = 'macos'
else: raise KaldiError("unknown sys.platform")
-exec_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'exec', platform)
+exec_dir = '/'
library_extension = dict(windows='.dll', linux='.so', macos='.dylib')[platform]
subprocess_seperator = '^&' if platform == 'windows' else ';'
@@ -89,13 +89,13 @@ class ExternalProcess(object):
shell = ush.Shell(raise_on_error=True)
- fstcompile = shell(os.path.join(exec_dir, 'fstcompile'))
- fstarcsort = shell(os.path.join(exec_dir, 'fstarcsort'))
- fstaddselfloops = shell(os.path.join(exec_dir, 'fstaddselfloops'))
- fstinfo = shell(os.path.join(exec_dir, 'fstinfo'))
- # compile_graph = shell(os.path.join(exec_dir, 'compile-graph'))
- compile_graph_agf = shell(os.path.join(exec_dir, 'compile-graph-agf'))
- # compile_graph_agf_debug = shell(os.path.join(exec_dir, 'compile-graph-agf-debug'))
+ fstcompile = shell('fstcompile')
+ fstarcsort = shell('fstarcsort')
+ fstaddselfloops = shell('fstaddselfloops')
+ fstinfo = shell('fstinfo')
+ # compile_graph = shell('compile-graph')
+ compile_graph_agf = shell('compile-graph-agf')
+ # compile_graph_agf_debug = shell('compile-graph-agf-debug')
make_lexicon_fst = shell([sys.executable, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kaldi', 'make_lexicon_fst%s.py' % ('_py2' if PY2 else ''))])