commit 0c32bf4bda2a54b148ced038ea56acd01db83362 Author: Vaydheesh Date: Tue Apr 9 13:10:03 2019 +0530 Add the Apertium Binaries to Process' PATH while importing module diff --git a/apertium/__init__.py b/apertium/__init__.py index 2494fa5..37d13fc 100644 --- a/apertium/__init__.py +++ b/apertium/__init__.py @@ -50,6 +50,19 @@ def append_pair_path_windows(): # type (None) -> None append_pair_path(apertium_lang_path) +def update_path_windows(): + '''Adding the Apertium Binaries to Process' PATH''' + + if platform.system() == 'Windows': + install_path = os.environ['LOCALAPPDATA'] + current = os.environ['path'] + + apertium_path = os.path.join(install_path, 'apertium-all-dev', 'bin') + if os.path.isdir(apertium_path): + update_path = '{};{};'.format(current, apertium_path) + os.environ['path'] = update_path + + pair_paths = ['/usr/share/apertium', '/usr/local/share/apertium'] analyzers = {} # type: Dict[str, Tuple[str, str]] generators = {} # type: Dict[str, Tuple[str, str]] @@ -57,3 +70,4 @@ pairs = {} # type: Dict[str, str] for pair_path in pair_paths: _update_modes(pair_path) append_pair_path_windows() +update_path_windows()