commit efed2f9bc99e0d03f97ed70f705d3ed0db31270b Author: vaydheesh Date: Mon Jun 17 19:21:40 2019 +0000 Implemented Changes Suggested Fixed log Updated travis build script diff --git a/apertium/__init__.py b/apertium/__init__.py index cebf6ee..5fc18cf 100644 --- a/apertium/__init__.py +++ b/apertium/__init__.py @@ -1,3 +1,4 @@ +import logging import os import platform from typing import Dict, Tuple @@ -69,3 +70,5 @@ for pair_path in pair_paths: _update_modes(pair_path) append_pair_path_windows() update_path_windows() +logging.basicConfig(format='%(asctime)s %(message)s', level=logging.WARNING) +logger = logging.getLogger() diff --git a/apertium/utils.py b/apertium/utils.py index f62e8f9..0d01d5d 100644 --- a/apertium/utils.py +++ b/apertium/utils.py @@ -1,4 +1,3 @@ -import logging import subprocess import tempfile from typing import List @@ -36,14 +35,9 @@ def execute_pipeline(inp: str, commands: List[List[str]]) -> str: str """ end = inp.encode() - logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG) - logger = logging.getLogger() - logger.setLevel(logging.DEBUG) for command in commands: if 'lt-proc' == command[0]: - arg = '' - if len(command) == 3: - arg = command[1][1] + arg = command[1][1] if len(command) == 3 else '' path = command[-1] with tempfile.NamedTemporaryFile('w') as input_file, tempfile.NamedTemporaryFile('r') as output_file: text = end.decode() @@ -56,7 +50,7 @@ def execute_pipeline(inp: str, commands: List[List[str]]) -> str: fst.lt_proc(arg, path, input_file.name, output_file.name) end = output_file.read().encode() else: - logger.info('Calling subprocess %s', command[0]) + apertium.logger.warning('%s Calling subprocess %s', __name__, command[0]) proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE) end, _ = proc.communicate(end) return end.decode() diff --git a/build-swig-wrapper.sh b/build-swig-wrapper.sh index e80ea30..6ef4354 100755 --- a/build-swig-wrapper.sh +++ b/build-swig-wrapper.sh @@ -2,6 +2,6 @@ sudo apt-get install -y swig build-essential python3-setuptools git clone -b swig_wrapper https://github.com/Vaydheesh/lttoolbox.git cd lttoolbox || set -e -./autogen.sh && ./configure && make +./autogen.sh --enable-python-bindings && make cd python || set -e python3 setup.py install \ No newline at end of file