-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathsetup.py
executable file
·99 lines (84 loc) · 3.33 KB
/
setup.py
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env python3
from os import path
import platform
import re
from typing import List
from setuptools import find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
def install_binaries() -> None:
import apertium
apertium.installer.nightly = True
apertium.installer.install_apertium()
apertium.installer.install_module('eng')
apertium.installer.install_module('eng-spa')
def kaz_tat_install():
apertium.installer.nightly = False
ubuntu = apertium.installer.Debian()
if platform.system() == 'Linux':
ubuntu._install_package_source()
apertium.installer.install_module('kaz-tat')
apertium.installer.nightly = True
if platform.system() == 'Linux':
ubuntu._install_package_source()
kaz_tat_install()
apertium.installer.install_wrapper('python3-apertium-core')
apertium.installer.install_wrapper('python3-apertium-lex-tools')
apertium.installer.install_wrapper('python3-cg3')
apertium.installer.install_wrapper('python3-lttoolbox')
apertium.installer.install_apertium_linux()
class CustomInstallCommand(install):
def run(self) -> None:
install.run(self)
install_binaries()
class CustomDevelopCommand(develop):
def run(self) -> None:
develop.run(self)
install_binaries()
def find_details(find_value: str, file_paths: List[str]) -> str:
pwd = path.abspath(path.dirname(__file__))
with open(path.join(pwd, *file_paths), 'r') as input_file:
match = re.search(r"^__{}__ = ['\"]([^'\"]*)['\"]".format(find_value), input_file.read(), re.M)
if match:
return match.group(1)
raise RuntimeError('Unable to find {} string.'.format(find_value))
setup(
name='apertium',
author=find_details('author', ['apertium', '__init__.py']),
author_email='[email protected]',
license=find_details('license', ['apertium', '__init__.py']),
version=find_details('version', ['apertium', '__init__.py']),
keywords='apertium machine translation linguistics',
description='Apertium core modules available in Python',
classifiers=[
'Development Status :: 3 - Alpha',
'Topic :: Text Processing :: Linguistic',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3 :: Only',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
],
long_description=open(path.join(path.abspath(path.dirname(__file__)), 'README.md')).read(),
long_description_content_type='text/markdown; charset=UTF-8',
platforms=['Debian', 'Windows'],
url='https://github.com/apertium/apertium-python',
python_requires='>=3.5',
setup_requires=[
'apertium-streamparser==5.0.2',
],
install_requires=[
'apertium-streamparser==5.0.2',
],
test_suite='tests',
package_data={'apertium': ['py.typed']},
packages=find_packages(exclude=['tests']),
cmdclass={
'develop': CustomDevelopCommand,
'install': CustomInstallCommand,
},
)