-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.py
102 lines (93 loc) · 3.98 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
100
101
102
from pathlib import Path
import os, setuptools, subprocess, sys
vsn = os.environ.get("JITEN_VERSION")
if not vsn:
from jiten.version import __version__
vsn = __version__.replace("-", ".dev", 1)
vsn = vsn.replace("-", "+", 1)
clean = "clean" in sys.argv[1:]
info = Path(__file__).with_name("README.md").read_text(encoding = "utf8")
pcre = setuptools.Extension("jiten._sqlite3_pcre", ["sqlite3-pcre.c"],
libraries = "pcre sqlite3".split())
data = [ "res/jlpt/N" + l + "-" + x for l in "12345"
for x in "kanji vocab-eng vocab-hiragana".split() ] \
+ [ "res/jlpt/" + x for x in "SOURCES *.sh *.html".split() ] \
+ [ "static/*." + x for x in "svg png css js txt".split() ] \
+ [ "static/audio/*.mp3" ] \
+ [ "static/font/*." + x for x in "ttf txt".split() ] \
+ [ "static/licenses/*.txt" ] \
+ [ "templates/*.html" ]
os.environ["PYTHON"] = sys.executable # use same python in make
if clean:
subprocess.run("make clean", shell = True, check = True)
else:
# "build" *.xml.gz
subprocess.run("make patch", shell = True, check = True)
if os.environ.get("JITEN_ANDROID") == "yes" or \
os.environ.get("JITEN_FINAL") == "yes":
if not clean:
subprocess.run("make _version", shell = True, check = True)
data += [ ".version" ]
if os.environ.get("JITEN_NODB") != "yes":
if not clean:
# "build" *.sqlite3
import jiten.cli
jiten.cli.cli("-v setup".split(), standalone_mode = False)
data += [ "res/*.sqlite3" ]
else:
data += [ "res/freq/" + x for x in """SOURCES base_aggregates.txt.nobom
wordfreq_ck.utf8""".split() ] \
+ [ "res/jmdict/" + x for x in "*.html Makefile".split() ] \
+ [ "res/jmdict/"+x+".xml.gz" for x in "jmdict kanjidic2".split() ] \
+ [ "res/pitch/" + x for x in "PITCH SOURCES *.html *.py *.sh".split() ] \
+ [ "res/radicals/" + x for x in "SOURCES *.xml.gz *.utf8".split() ] \
+ [ "res/sentences/" + x for x in "Makefile SENTENCES *.py".split() ]
setuptools.setup(
name = "jiten",
url = "https://github.com/obfusk/jiten",
description = "japanese cli&web dictionary based on jmdict/kanjidic",
long_description = info,
long_description_content_type = "text/markdown",
version = vsn,
author = "FC Stegerman",
author_email = "flx@obfusk.net",
license = "AGPLv3+",
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: Web Environment",
"Intended Audience :: End Users/Desktop",
"License :: Free for non-commercial use",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Natural Language :: Dutch",
"Natural Language :: English",
"Natural Language :: German",
"Natural Language :: Japanese",
"Operating System :: Android",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python :: 3",
"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 :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Education",
"Topic :: Utilities",
],
keywords = "japanese kanji dictionary cli web jmdict kanjidic",
packages = setuptools.find_packages(),
package_data = dict(jiten = data),
entry_points = dict(
console_scripts = ["jiten = jiten.cli:main"],
gui_scripts = ["jiten-gui = jiten.cli:gui_main [gui]"],
),
python_requires = ">=3.8",
install_requires = ["Flask", "click>=6.0", "kanjidraw>=0.2.1"],
extras_require = dict(gui = ["pywebview>=3.3.5"]),
ext_modules = [pcre],
)