commit adf9d96ae84caa8ac19665e4517fada2d1690f1c Author: vaydheesh Date: Mon Jul 22 18:21:19 2019 +0530 mock streamparser import apertium in setup.py, causes import error, if apertium-streamparser isnt available during installation diff --git a/apertium/installer.py b/apertium/installer.py index 9c4a435..1702bd8 100644 --- a/apertium/installer.py +++ b/apertium/installer.py @@ -115,7 +115,7 @@ class Ubuntu: execute.check_returncode() @staticmethod - def _rename_wrappers(): + def _rename_wrappers() -> None: wrapper_name = { 'python3-apertium': '_apertium_core', 'python3-apertium-lex-tools': '_lextools', diff --git a/setup.py b/setup.py index 2b800ad..3c9395f 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,8 @@ from atexit import register from os import path from setuptools import find_packages, setup # noqa: I202 from setuptools.command.install import install +import sys +from unittest.mock import Mock class PostInstallCommand(install): @@ -11,6 +13,9 @@ class PostInstallCommand(install): @staticmethod def _post_install(): + # mock apertium-streamparser for importing apertium + sys.modules['streamparser'] = Mock() + import apertium apertium.installer.install_apertium() apertium.installer.install_module('eng')