-
Notifications
You must be signed in to change notification settings - Fork 16
/
setup.py
93 lines (81 loc) · 2.91 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
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Jaepil Jeong
from __future__ import print_function
import os
from setuptools import setup
from setuptools.command.install import install
try:
from urllib import urlretrieve
except:
from urllib.request import urlretrieve
__VERSION__ = "0.1.5"
_JAVA_LIB_URLS = [
"https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.4/scala-library-2.11.4.jar",
"https://repo1.maven.org/maven2/org/apache/thrift/libthrift/0.9.2/libthrift-0.9.2.jar",
"https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.14/snakeyaml-1.14.jar",
"https://repo1.maven.org/maven2/com/twitter/twitter-text/1.10.2/twitter-text-1.10.2.jar",
"https://repo1.maven.org/maven2/com/twitter/penguin/korean-text/2.3.3/korean-text-2.3.3.jar",
]
_PATH_TO_LIB = os.path.join(os.path.abspath(os.path.dirname((__file__))), "twkorean/data/lib")
class InstallCommand(install):
@staticmethod
def download_jars(target_path):
for url in _JAVA_LIB_URLS:
jar_name = os.path.basename(url)
jar_path = os.path.join(target_path, jar_name)
if not os.path.exists(jar_path):
print("Downloading java package:", jar_name)
print("Saved java package to:", jar_path)
urlretrieve(url, jar_path)
def run(self):
self.download_jars(target_path=_PATH_TO_LIB)
install.run(self)
setup(
name="twkorean",
license="Apache 2.0",
version=__VERSION__,
packages=["twkorean"],
package_dir={"twkorean": "twkorean"},
package_data={
"twkorean": [
"data/lib/*.jar",
],
},
install_requires=[
"JPype1"
],
author="Jaepil Jeong",
author_email="jaepil@{nospam}appspand.com",
url="https://github.com/jaepil/twkorean/",
download_url="https://github.com/jaepil/twkorean/tree/master",
classifiers=[
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Natural Language :: Korean",
"Programming Language :: Java",
"Programming Language :: Python",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Linguistic"
],
platforms=[
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows :: Windows 7",
"Operating System :: Microsoft :: Windows :: Windows Vista",
"Operating System :: POSIX :: Linux",
],
keywords=[
"twitter-korean-text",
"morphological analyzer",
"morphology", "analyzer"
"korean", "tokenizer"
],
description="Python interface to twitter-korean-text, a Korean morphological analyzer.",
cmdclass={
'install': InstallCommand,
}
)