commit 716a26c6ba1fbfe2e327d362362b42455028e3b2 Author: vaydheesh Date: Sat Jul 20 19:24:43 2019 +0530 rename wrappers diff --git a/apertium/installer.py b/apertium/installer.py index 8390cad..58bcfc8 100644 --- a/apertium/installer.py +++ b/apertium/installer.py @@ -123,13 +123,21 @@ class Ubuntu: execute.check_returncode() @staticmethod - def _rename_wrappers(): + def _rename_wrappers(wrapper_name: dict = None): + if wrapper_name is None: + wrapper_name = { + 'python3-apertium': '_apertium_core', + 'python3-apertium-lex-tools': '_lextools', + 'python3-lttoolbox': '_lttoolbox', + } dist_package = '/usr/lib/python3/dist-packages' - for f in os.listdir(dist_package): - if f.startswith('_lttoolbox'): - old_name = os.path.join(dist_package, f) - new_name = os.path.join(dist_package, '{}.so'.format(f.split('.')[0])) - subprocess.run(['sudo', 'mv', old_name, new_name]) + for wrapper in wrapper_name.values(): + for f in os.listdir(dist_package): + if f.startswith(wrapper): + old_name = os.path.join(dist_package, f) + new_name = os.path.join(dist_package, '{}.so'.format(f.split('.')[0])) + if old_name != new_name: + subprocess.run(['sudo', 'mv', old_name, new_name]) def install_apertium_language(self, languages: List[str]) -> None: self._download_packages(languages) diff --git a/build-swig-wrapper.sh b/build-swig-wrapper.sh index 8ad4e55..53d0e65 100755 --- a/build-swig-wrapper.sh +++ b/build-swig-wrapper.sh @@ -10,11 +10,3 @@ cd python make -j2 python3 setup.py install popd - -git clone --depth 1 https://github.com/apertium/apertium.git apertium-core -pushd apertium-core -./autogen.sh --enable-python-bindings -cd python -make -j2 -python3 setup.py install -popd diff --git a/setup.py b/setup.py index a1035ff..e73f2fa 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,8 @@ class PostInstallCommand(install): import apertium apertium.installer.install_apertium() apertium.installer.install_language_pack(['apertium-eng', 'apertium-en-es']) - apertium.installer.install_wrapper(['python3-lttoolbox']) + apertium.installer.install_wrapper(['python3-apertium', 'python3-apertium-lex-tools', + 'python3-lttoolbox']) setup( name='apertium-python',