-
Notifications
You must be signed in to change notification settings - Fork 127
/
setup.py
executable file
·155 lines (138 loc) · 4.53 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/usr/bin/env python
import subprocess
from distutils.core import setup
from ldoce5viewer import __version__
def iter_static():
import os
import os.path
for root, dirs, files in os.walk("ldoce5viewer/static"):
for filename in files:
yield os.path.relpath(os.path.join(root, filename), "ldoce5viewer")
for root, dirs, files in os.walk("ldoce5viewer/qtgui/resources"):
for filename in files:
yield os.path.relpath(os.path.join(root, filename), "ldoce5viewer")
for root, dirs, files in os.walk("ldoce5viewer/qtgui/ui"):
for filename in files:
yield os.path.relpath(os.path.join(root, filename), "ldoce5viewer")
extra_options = {}
# --------
# py2exe
# --------
try:
import py2exe
except ImportError:
pass
else:
extra_options.update(
dict(
name="LDOCE5 Viewer",
windows=[
{
"script": "ldoce5viewer.py",
"icon_resources": [(1, "ldoce5viewer/resources/ldoce5viewer.ico")],
}
],
options={
"py2exe": {
"includes": ["sip"],
"packages": ["lxml.etree", "gzip", "lxml._elementpath"],
#'excludes': ['_ssl', 'ssl', 'bz2', 'sqlite3', 'select',
# 'xml', 'unittest', 'email', 'distutils', 'xmlrpclib',
# 'doctest', 'pdb', 'tarfile'],
"compressed": True,
"optimize": 2,
"bundle_files": 3,
"dist_dir": "exedist",
}
},
zipfile=None,
)
)
# --------
# py2app
# --------
try:
import py2app
except ImportError:
pass
else:
qt_plugins_path = subprocess.check_output(
"qmake -query QT_INSTALL_PLUGINS", shell=True
)
qt_plugins_path = qt_plugins_path[0 : len(qt_plugins_path) - 1] # remove "\n"
extra_options.update(
dict(
name="LDOCE5 Viewer",
app=["ldoce5viewer.py"],
options={
"py2app": {
"iconfile": "./ldoce5viewer/qtgui/resources/ldoce5viewer.icns",
"argv_emulation": False,
"optimize": 0,
"includes": ["sip", "lxml._elementpath"],
"packages": [],
"excludes": [
"email",
"sqlite3",
"PySide6.QtCLucene",
"PySide6.QtHtml",
"PySide6.QtHelp",
"PySide6.QtTest",
"PySide6.QtOpenGL",
"PySide6.QtScript",
"PySide6.QtScriptTools",
"PySide6.QtSql",
"PySide6.QtDeclarative",
"PySide6.QtMultimedia",
"PySide6.QtDesigner",
"PySide6.QtXml",
"PySide6.QtXmlPatterns",
],
#'qt_plugins': [
# 'imageformats/libqjpeg.dylib',
# ]
}
},
data_files=[
("qt_plugins/imageformats", [qt_plugins_path]),
("", ["ldoce5viewer/static"]),
],
)
)
# ------------
# setup(...)
# ------------
if "name" not in extra_options:
extra_options["name"] = "ldoce5viewer"
setup(
version=__version__,
description="LDOCE5 Viewer",
url="https://forward-backward.co.jp/ldoce5viewer/",
license="GPLv3+",
platforms="any",
classifiers=[
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Development Status :: 5 - Production/Stable"
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Education",
"Programming Language :: Python",
"Operating System :: OS Independent",
"Topic :: Education",
],
author="Taku Fukada",
author_email="[email protected]",
package_dir={"ldoce5viewer": "ldoce5viewer"},
packages=[
"ldoce5viewer",
"ldoce5viewer.qtgui",
"ldoce5viewer.qtgui.ui",
"ldoce5viewer.qtgui.resources",
"ldoce5viewer.qtgui.utils",
"ldoce5viewer.qtgui.utils.mp3play",
"ldoce5viewer.utils",
"ldoce5viewer.ldoce5",
],
package_data={"ldoce5viewer": list(iter_static())},
scripts=["scripts/ldoce5viewer"],
**extra_options
)