commit 87e637236eadf3a7aca7a0e90bcf5ac126699618 Author: vaydheesh Date: Fri Jun 14 02:43:24 2019 +0000 Added: Script to build lttoolbox wrapper for travis diff --git a/.travis.yml b/.travis.yml index 048e7f6..a4d0b3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ python: install: - pip install pipenv - travis_retry pipenv install --dev --system + - ./BuildSwigWrapper.sh before_script: - wget http://apertium.projectjj.com/apt/install-nightly.sh -O - | sudo bash - sudo apt-get -f --allow-unauthenticated install apertium-all-dev diff --git a/BuildSwigWrapper.sh b/BuildSwigWrapper.sh new file mode 100755 index 0000000..d42b0fd --- /dev/null +++ b/BuildSwigWrapper.sh @@ -0,0 +1,7 @@ +#! /bin/bash +sudo apt-get install -y swig build-essential python3-setuptools +git clone -b swig_wrapper https://github.com/Vaydheesh/lttoolbox.git +cd lttoolbox || return +./autogen.sh && ./configure && make +cd python || return +python3 setup.py install \ No newline at end of file diff --git a/apertium/lttoolbox.py b/apertium/lttoolbox.py index fa01f58..1dcd39f 100644 --- a/apertium/lttoolbox.py +++ b/apertium/lttoolbox.py @@ -2,10 +2,7 @@ import platform import tempfile from typing import ByteString # noqa: F401 -if platform.system() == 'Linux': - from apertium.swig.linux import lttoolbox -elif platform.system() == 'Windows': - pass +import lttoolbox class LtProc: diff --git a/apertium/swig/linux/__init__.py b/apertium/swig/linux/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/apertium/swig/linux/_lttoolbox.cpython-35m-x86_64-linux-gnu.so b/apertium/swig/linux/_lttoolbox.cpython-35m-x86_64-linux-gnu.so deleted file mode 100755 index 1143045..0000000 Binary files a/apertium/swig/linux/_lttoolbox.cpython-35m-x86_64-linux-gnu.so and /dev/null differ diff --git a/apertium/swig/linux/_lttoolbox.cpython-36m-x86_64-linux-gnu.so b/apertium/swig/linux/_lttoolbox.cpython-36m-x86_64-linux-gnu.so deleted file mode 100755 index 174bb25..0000000 Binary files a/apertium/swig/linux/_lttoolbox.cpython-36m-x86_64-linux-gnu.so and /dev/null differ diff --git a/apertium/swig/linux/_lttoolbox.cpython-37m-x86_64-linux-gnu.so b/apertium/swig/linux/_lttoolbox.cpython-37m-x86_64-linux-gnu.so deleted file mode 100755 index f95708e..0000000 Binary files a/apertium/swig/linux/_lttoolbox.cpython-37m-x86_64-linux-gnu.so and /dev/null differ diff --git a/apertium/swig/linux/lttoolbox.py b/apertium/swig/linux/lttoolbox.py deleted file mode 100644 index 62064ec..0000000 --- a/apertium/swig/linux/lttoolbox.py +++ /dev/null @@ -1,282 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 4.0.0 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - -from sys import version_info as _swig_python_version_info -if _swig_python_version_info < (2, 7, 0): - raise RuntimeError('Python 2.7 or later required') - -# Import the low-level C/C++ module -if __package__ or '.' in __name__: - from . import _lttoolbox -else: - import _lttoolbox - -try: - import builtins as __builtin__ -except ImportError: - import __builtin__ - -def _swig_setattr_nondynamic(self, class_type, name, value, static=1): - if name == "thisown": - return self.this.own(value) - if name == "this": - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name, None) - if method: - return method(self, value) - if not static: - object.__setattr__(self, name, value) - else: - raise AttributeError("You cannot add attributes to %s" % self) - - -def _swig_setattr(self, class_type, name, value): - return _swig_setattr_nondynamic(self, class_type, name, value, 0) - - -def _swig_getattr(self, class_type, name): - if name == "thisown": - return self.this.own() - method = class_type.__swig_getmethods__.get(name, None) - if method: - return method(self) - raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) - - -def _swig_repr(self): - try: - strthis = "proxy of " + self.this.__repr__() - except __builtin__.Exception: - strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - - -def _swig_setattr_nondynamic_instance_variable(set): - def set_instance_attr(self, name, value): - if name == "thisown": - self.this.own(value) - elif name == "this": - set(self, name, value) - elif hasattr(self, name) and isinstance(getattr(type(self), name), property): - set(self, name, value) - else: - raise AttributeError("You cannot add instance attributes to %s" % self) - return set_instance_attr - - -def _swig_setattr_nondynamic_class_variable(set): - def set_class_attr(cls, name, value): - if hasattr(cls, name) and not isinstance(getattr(cls, name), property): - set(cls, name, value) - else: - raise AttributeError("You cannot add class attributes to %s" % cls) - return set_class_attr - - -def _swig_add_metaclass(metaclass): - """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" - def wrapper(cls): - return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) - return wrapper - - -class _SwigNonDynamicMeta(type): - """Meta class to enforce nondynamic attributes (no new attributes) for a class""" - __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) - - -gm_clean = _lttoolbox.gm_clean -gm_unknown = _lttoolbox.gm_unknown -gm_all = _lttoolbox.gm_all -gm_tagged = _lttoolbox.gm_tagged -gm_tagged_nm = _lttoolbox.gm_tagged_nm -gm_carefulcase = _lttoolbox.gm_carefulcase -class FSTProcessor(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def __init__(self): - _lttoolbox.FSTProcessor_swiginit(self, _lttoolbox.new_FSTProcessor()) - - def initAnalysis(self): - return _lttoolbox.FSTProcessor_initAnalysis(self) - - def initTMAnalysis(self): - return _lttoolbox.FSTProcessor_initTMAnalysis(self) - - def initSAO(self): - return _lttoolbox.FSTProcessor_initSAO(self) - - def initGeneration(self): - return _lttoolbox.FSTProcessor_initGeneration(self) - - def initPostgeneration(self): - return _lttoolbox.FSTProcessor_initPostgeneration(self) - - def initBiltrans(self): - return _lttoolbox.FSTProcessor_initBiltrans(self) - - def initDecomposition(self): - return _lttoolbox.FSTProcessor_initDecomposition(self) - - def analysis(self, *args): - return _lttoolbox.FSTProcessor_analysis(self, *args) - - def tm_analysis(self, *args): - return _lttoolbox.FSTProcessor_tm_analysis(self, *args) - - def generation(self, *args): - return _lttoolbox.FSTProcessor_generation(self, *args) - - def postgeneration(self, *args): - return _lttoolbox.FSTProcessor_postgeneration(self, *args) - - def intergeneration(self, *args): - return _lttoolbox.FSTProcessor_intergeneration(self, *args) - - def transliteration(self, *args): - return _lttoolbox.FSTProcessor_transliteration(self, *args) - - def biltrans(self, input_word, with_delim=True): - return _lttoolbox.FSTProcessor_biltrans(self, input_word, with_delim) - - def biltransfull(self, input_word, with_delim=True): - return _lttoolbox.FSTProcessor_biltransfull(self, input_word, with_delim) - - def bilingual(self, *args): - return _lttoolbox.FSTProcessor_bilingual(self, *args) - - def biltransWithQueue(self, input_word, with_delim=True): - return _lttoolbox.FSTProcessor_biltransWithQueue(self, input_word, with_delim) - - def biltransWithoutQueue(self, input_word, with_delim=True): - return _lttoolbox.FSTProcessor_biltransWithoutQueue(self, input_word, with_delim) - - def SAO(self, *args): - return _lttoolbox.FSTProcessor_SAO(self, *args) - - def parseICX(self, file): - return _lttoolbox.FSTProcessor_parseICX(self, file) - - def parseRCX(self, file): - return _lttoolbox.FSTProcessor_parseRCX(self, file) - - def load(self, input): - return _lttoolbox.FSTProcessor_load(self, input) - - def lsx(self, input, output): - return _lttoolbox.FSTProcessor_lsx(self, input, output) - - def valid(self): - return _lttoolbox.FSTProcessor_valid(self) - - def setCaseSensitiveMode(self, value): - return _lttoolbox.FSTProcessor_setCaseSensitiveMode(self, value) - - def setDictionaryCaseMode(self, value): - return _lttoolbox.FSTProcessor_setDictionaryCaseMode(self, value) - - def setBiltransSurfaceForms(self, value): - return _lttoolbox.FSTProcessor_setBiltransSurfaceForms(self, value) - - def setIgnoredChars(self, value): - return _lttoolbox.FSTProcessor_setIgnoredChars(self, value) - - def setRestoreChars(self, value): - return _lttoolbox.FSTProcessor_setRestoreChars(self, value) - - def setNullFlush(self, value): - return _lttoolbox.FSTProcessor_setNullFlush(self, value) - - def setUseDefaultIgnoredChars(self, value): - return _lttoolbox.FSTProcessor_setUseDefaultIgnoredChars(self, value) - - def setDisplayWeightsMode(self, value): - return _lttoolbox.FSTProcessor_setDisplayWeightsMode(self, value) - - def setMaxAnalysesValue(self, value): - return _lttoolbox.FSTProcessor_setMaxAnalysesValue(self, value) - - def setMaxWeightClassesValue(self, value): - return _lttoolbox.FSTProcessor_setMaxWeightClassesValue(self, value) - - def getNullFlush(self): - return _lttoolbox.FSTProcessor_getNullFlush(self) - - def getDecompoundingMode(self): - return _lttoolbox.FSTProcessor_getDecompoundingMode(self) - __swig_destroy__ = _lttoolbox.delete_FSTProcessor - -# Register FSTProcessor in _lttoolbox: -_lttoolbox.FSTProcessor_swigregister(FSTProcessor) - -HAVE_DECL_FGETC_UNLOCKED = _lttoolbox.HAVE_DECL_FGETC_UNLOCKED -HAVE_DECL_FGETWC_UNLOCKED = _lttoolbox.HAVE_DECL_FGETWC_UNLOCKED -HAVE_DECL_FPUTS_UNLOCKED = _lttoolbox.HAVE_DECL_FPUTS_UNLOCKED -HAVE_DECL_FPUTWC_UNLOCKED = _lttoolbox.HAVE_DECL_FPUTWC_UNLOCKED -HAVE_DECL_FPUTWS_UNLOCKED = _lttoolbox.HAVE_DECL_FPUTWS_UNLOCKED -HAVE_DECL_FREAD_UNLOCKED = _lttoolbox.HAVE_DECL_FREAD_UNLOCKED -HAVE_DECL_FWRITE_UNLOCKED = _lttoolbox.HAVE_DECL_FWRITE_UNLOCKED -HAVE_DLFCN_H = _lttoolbox.HAVE_DLFCN_H -HAVE_GETOPT_LONG = _lttoolbox.HAVE_GETOPT_LONG -HAVE_INTTYPES_H = _lttoolbox.HAVE_INTTYPES_H -HAVE_LIBXML2 = _lttoolbox.HAVE_LIBXML2 -HAVE_MEMORY_H = _lttoolbox.HAVE_MEMORY_H -HAVE_PYTHON = _lttoolbox.HAVE_PYTHON -HAVE_SETLOCALE = _lttoolbox.HAVE_SETLOCALE -HAVE_STDDEF_H = _lttoolbox.HAVE_STDDEF_H -HAVE_STDINT_H = _lttoolbox.HAVE_STDINT_H -HAVE_STDLIB_H = _lttoolbox.HAVE_STDLIB_H -HAVE_STRDUP = _lttoolbox.HAVE_STRDUP -HAVE_STRINGS_H = _lttoolbox.HAVE_STRINGS_H -HAVE_STRING_H = _lttoolbox.HAVE_STRING_H -HAVE_SYS_STAT_H = _lttoolbox.HAVE_SYS_STAT_H -HAVE_SYS_TYPES_H = _lttoolbox.HAVE_SYS_TYPES_H -HAVE_UNISTD_H = _lttoolbox.HAVE_UNISTD_H -LT_OBJDIR = _lttoolbox.LT_OBJDIR -PACKAGE_BUGREPORT = _lttoolbox.PACKAGE_BUGREPORT -PACKAGE_NAME = _lttoolbox.PACKAGE_NAME -PACKAGE_STRING = _lttoolbox.PACKAGE_STRING -PACKAGE_TARNAME = _lttoolbox.PACKAGE_TARNAME -PACKAGE_URL = _lttoolbox.PACKAGE_URL -PACKAGE_VERSION = _lttoolbox.PACKAGE_VERSION -STDC_HEADERS = _lttoolbox.STDC_HEADERS -class LtLocale(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - @staticmethod - def tryToSetLocale(): - return _lttoolbox.LtLocale_tryToSetLocale() - - def __init__(self): - _lttoolbox.LtLocale_swiginit(self, _lttoolbox.new_LtLocale()) - __swig_destroy__ = _lttoolbox.delete_LtLocale - -# Register LtLocale in _lttoolbox: -_lttoolbox.LtLocale_swigregister(LtLocale) - -def LtLocale_tryToSetLocale(): - return _lttoolbox.LtLocale_tryToSetLocale() - -class FST(FSTProcessor): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def analyze(self, automorf_path, input_path, output_path): - return _lttoolbox.FST_analyze(self, automorf_path, input_path, output_path) - - def __init__(self): - _lttoolbox.FST_swiginit(self, _lttoolbox.new_FST()) - __swig_destroy__ = _lttoolbox.delete_FST - -# Register FST in _lttoolbox: -_lttoolbox.FST_swigregister(FST) - - -