forked from Arelle/Arelle
-
Notifications
You must be signed in to change notification settings - Fork 1
/
distro.py
124 lines (118 loc) · 4.05 KB
/
distro.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
"""
See COPYRIGHT.md for copyright information.
"""
import os
import sys
from cx_Freeze import Executable, setup
from setuptools import find_packages
LINUX_PLATFORM = "linux"
MACOS_PLATFORM = "darwin"
WINDOWS_PLATFORM = "win32"
cliExecutable = Executable(script="arelleCmdLine.py")
packages = find_packages()
includeFiles = [
(os.path.normcase("arelle/config"), "config"),
(os.path.normcase("arelle/doc"), "doc"),
(os.path.normcase("arelle/images"), "images"),
(os.path.normcase("arelle/locale"), "locale"),
(os.path.normcase("arelle/examples"), "examples"),
(os.path.normcase("arelle/examples/plugin"), os.path.normcase("examples/plugin")),
(
os.path.normcase("arelle/examples/plugin/locale/fr/LC_MESSAGES"),
os.path.normcase("examples/plugin/locale/fr/LC_MESSAGES"),
),
(os.path.normcase("arelle/plugin"), "plugin"),
]
includeLibs = [
"aniso8601",
"graphviz",
"gzip",
"holidays",
"holidays.countries",
"holidays.financial",
"isodate",
"lxml._elementpath",
"lxml.etree",
"lxml.html",
"lxml",
"numpy.core._methods",
"numpy.lib.format",
"numpy",
"openpyxl",
"pg8000",
"PIL",
"pycountry",
"pymysql",
"regex",
"sqlite3",
"tinycss2",
"zlib",
]
options = {
"build_exe": {
"include_files": includeFiles,
"includes": includeLibs,
"packages": packages,
}
}
if os.path.exists("arelle/plugin/EdgarRenderer"):
includeLibs.append("cherrypy")
includeLibs.append("dateutil")
includeLibs.append("dateutil.relativedelta")
includeLibs.append("matplotlib")
includeLibs.append("matplotlib.pyplot")
includeLibs.append("pyparsing")
includeLibs.append("pytz")
includeLibs.append("six")
includeLibs.append("tornado")
if sys.platform == LINUX_PLATFORM:
guiExecutable = Executable(script="arelleGUI.py", target_name="arelleGUI")
includeLibs.append("Crypto")
includeLibs.append("Crypto.Cipher")
includeLibs.append("Crypto.Cipher.AES")
includeFiles.append(("arelle/scripts-unix", "scripts"))
if os.path.exists("/etc/redhat-release"):
includeFiles.append(("/usr/lib64/libexslt.so.0", "libexslt.so"))
includeFiles.append(("/usr/lib64/libxml2.so", "libxml2.so"))
includeFiles.append(("/usr/lib64/libxml2.so.2", "libxml2.so.2"))
includeFiles.append(("/usr/lib64/libxslt.so.1", "libxslt.so"))
includeFiles.append(("/lib64/libz.so.1", "libz.so.1"))
includeFiles.append(("/usr/lib64/liblzma.so.5", "liblzma.so.5"))
includeFiles.append(("/usr/local/lib/tcl8.6", "tcl8.6"))
includeFiles.append(("/usr/local/lib/tk8.6", "tk8.6"))
elif sys.platform == MACOS_PLATFORM:
guiExecutable = Executable(script="arelleGUI.py", target_name="arelleGUI")
includeFiles.append(("arelle/scripts-macOS", "scripts"))
includeFiles.append(("libs/macos/Tktable2.11", "Tktable2.11"))
options["bdist_mac"] = {
"iconfile": "arelle/images/arelle.icns",
"bundle_name": "Arelle",
}
elif sys.platform == WINDOWS_PLATFORM:
guiExecutable = Executable(
script="arelleGUI.pyw",
base="Win32GUI",
icon="arelle\\images\\arelle16x16and32x32.ico",
)
includeFiles.append(("arelle\\scripts-windows", "scripts"))
if "arelle.webserver" in packages:
includeFiles.append("QuickBooks.qwc")
# note cx_Oracle isn't included for unix builds because it is version and machine specific.
includeLibs.append("cx_Oracle")
includeLibs.append("pyodbc")
includeLibs.append("requests")
includeLibs.append("requests_negotiate_sspi")
options["build_exe"]["include_msvcr"] = True
else:
raise ValueError(
f"Frozen builds are supported on Windows, Linux, and macOS. Platform {sys.platform} is not supported."
)
setup(
executables=[guiExecutable, cliExecutable],
options=options,
setup_requires=["setuptools_scm~=7.0"],
use_scm_version={
"tag_regex": r"^(?:[\w-]+-?)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$",
"write_to": os.path.normcase("arelle/_version.py"),
},
)