1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
from os import listdir, path
from setuptools import setup, find_packages
from setuptools.command.install import install
from subprocess import check_call, CalledProcessError
from apertium_apy import apy
class InstallHelper(install):
def run(self):
try:
check_call(['make', 'langNames.db'])
except CalledProcessError:
pass
super().run()
try:
check_call(['make', 'clean'])
except CalledProcessError:
pass
def files(root):
for file_or_dir in listdir(root):
full_path = path.join(root, file_or_dir)
if path.isfile(full_path):
yield full_path
setup(
name='apertium-apy',
version=apy.__version__,
license=apy.__license__,
description='Apertium Web Service',
long_description=open(path.join(path.abspath(path.dirname(__file__)), 'README.md')).read(),
long_description_content_type='text/markdown; charset=UTF-8',
keywords='apertium parsing linguistics server',
author='Apertium',
author_email='sushain@skc.name',
url='https://github.com/apertium/apertium-apy',
classifiers=[
'Development Status :: 4 - Beta',
'Topic :: Text Processing :: Linguistic',
'Topic :: Internet :: WWW/HTTP :: HTTP Servers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3 :: Only',
],
python_requires='>=3.8',
install_requires=['tornado>=4.2,<7'],
extras_require={
'spelling': ['apertium-streamparser'],
'suggestions': ['requests'],
'website_encoding_detect': ['chardet'],
'lang_detect': ['chromium_compact_language_detector'],
'pair_preferences': ['lxml'],
'full': ['apertium-streamparser', 'requests', 'chardet', 'chromium_compact_language_detector', 'commentjson', 'lxml'],
},
entry_points={
'console_scripts': ['apertium-apy=apertium_apy.apy:main'],
},
packages=find_packages(exclude=['tests']),
data_files=[
('share/apertium-apy', ['README.md', 'COPYING', 'langNames.db', 'lid.release.ftz', 'lid.beta.ftz', 'index.html']),
('share/apertium-apy/tools', files('tools')),
('share/apertium-apy/tools/systemd', files('tools/systemd')),
('share/apertium-apy/tools/sysvinit', files('tools/sysvinit')),
],
cmdclass={
'install': InstallHelper,
},
)
|