source: setup.py@ 1030:1365902665d4

python3
Last change on this file since 1030:1365902665d4 was 1030:1365902665d4, checked in by István Váradi <ivaradi@…>, 3 years ago

The scalable icons are also included in the distribution on Windows

File size: 11.6 KB
Line 
1# -*- coding: iso-8859-2 -*-
2
3import sys
4import os
5from glob import glob
6from distutils.core import setup
7from pathlib import Path
8
9scriptdir=os.path.dirname(sys.argv[0])
10sys.path.insert(0, os.path.join(scriptdir, "src"))
11
12import mlx.const
13import mlx.update
14
15defaultManifest="""<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
16<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
17 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
18 <security>
19 <requestedPrivileges>
20 <requestedExecutionLevel level="asInvoker"/>
21 </requestedPrivileges>
22 </security>
23 </trustInfo>
24 <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
25 <application>
26 <!--The ID below indicates application support for Windows Vista -->
27 <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
28 <!--The ID below indicates application support for Windows 7 -->
29 <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
30 <!--The ID below indicates application support for Windows 8 -->
31 <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
32 <!--The ID below indicates application support for Windows 8.1 -->
33 <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
34 <!--The ID below indicates application support for Windows 10 -->
35 <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
36 </application>
37 </compatibility>
38</assembly>"""
39
40adminManifest=defaultManifest.replace("asInvoker", "requireAdministrator")
41
42RT_MANIFEST=24
43
44data_files = [("sounds", glob(os.path.join("sounds", "*.*")))]
45for language in ["en", "hu"]:
46 data_files.append((os.path.join("doc", "manual", language),
47 glob(os.path.join("doc", "manual", language, "*.*"))))
48 data_files.append((os.path.join("locale", language, "LC_MESSAGES"),
49 [os.path.join("locale", language, "LC_MESSAGES",
50 "mlx.mo")]))
51
52rootFiles = ["logo.png", "conn_grey.png", "conn_red.png", "conn_green.png"]
53if os.name!="nt":
54 rootFiles.append("Microsoft.VC90.CRT.manifest")
55data_files.append(("", rootFiles))
56
57if os.name=="nt":
58 import py2exe
59
60 data_files.append(("", ["logo.ico"]))
61
62 msvcrDir = os.environ["MSVCRDIR"] if "MSVCRDIR" in os.environ else None
63 if msvcrDir:
64 data_files.append(("Microsoft.VC90.CRT",
65 ["Microsoft.VC90.CRT.manifest"] +
66 glob(os.path.join(msvcrDir, "*.*"))))
67 os.environ["PATH"] = os.environ["PATH"] + ";" + glob(os.path.join(msvcrDir))[0]
68
69 gtkRuntimeDir = os.environ["GTKRTDIR"] if "GTKRTDIR" in os.environ else None
70 if gtkRuntimeDir:
71 if gtkRuntimeDir.endswith("/mingw32"):
72 files = {}
73
74 for components in [ ["lib", "girepository-1.0"],
75 ["lib", "gdk-pixbuf-2.0", "2.10.0", "loaders.cache"],
76 ["lib", "gdk-pixbuf-2.0", "2.10.0", "loaders", "libpixbufloader-ico.dll"],
77 ["lib", "gdk-pixbuf-2.0", "2.10.0", "loaders", "libpixbufloader-png.dll"],
78 ["lib", "gdk-pixbuf-2.0", "2.10.0", "loaders", "libpixbufloader-svg.dll"],
79 ["share", "icons", "Adwaita", "icon-theme.cache"],
80 ["share", "icons", "Adwaita", "index.theme"],
81 ["share", "icons", "Adwaita", "16x16"],
82 ["share", "icons", "Adwaita", "scalable"],
83 ["share", "locale", "hu"],
84 ["share", "locale", "en"],
85 ["share", "themes"],
86 ["share", "glib-2.0", "schemas"]]:
87 path = os.path.join(*components)
88 p = Path(os.path.join(gtkRuntimeDir, path))
89 if p.is_file():
90 d = os.path.dirname(path)
91 if d in files:
92 files[d].append(str(p))
93 else:
94 files[d] = [str(p)]
95 else:
96 for f in p.glob("**/*"):
97 if f.is_file():
98 d = os.path.join(path, str(f.parent.relative_to(p)))
99 if d in files:
100 files[d].append(str(f))
101 else:
102 files[d] = [str(f)]
103
104 for path in files:
105 data_files.append((path, files[path]))
106 data_files.append(("",
107 [os.path.join(gtkRuntimeDir, "bin", "librsvg-2-2.dll"),
108 os.path.join(gtkRuntimeDir, "bin", "libcroco-0.6-3.dll")]))
109 else:
110 path = os.path.join("lib", "gtk-2.0", "2.10.0", "engines")
111 data_files.append((os.path.join("library", path),
112 [os.path.join(gtkRuntimeDir, path, "libwimp.dll")]))
113
114 path = os.path.join("share", "themes", "MS-Windows", "gtk-2.0")
115 data_files.append((os.path.join("library", path),
116 glob(os.path.join(gtkRuntimeDir, path, "*"))))
117
118 path = os.path.join("share", "locale", "hu", "LC_MESSAGES")
119 data_files.append((os.path.join("library", path),
120 glob(os.path.join(gtkRuntimeDir, path, "*"))))
121 path = os.path.join("share", "icons", "hicolor")
122 data_files.append((os.path.join("library", path),
123 glob(os.path.join(gtkRuntimeDir, path, "*"))))
124
125 cefDir = os.environ.get("CEFDIR")
126 if cefDir:
127 for fileName in ["icudtl.dat", "subprocess.exe", "natives_blob.bin",
128 "snapshot_blob.bin", "v8_context_snapshot.bin",
129 "cef.pak", "cef_100_percent.pak",
130 "cef_200_percent.pak", "cef_extensions.pak"]:
131 data_files.append(("", [os.path.join(cefDir, fileName)]))
132
133 data_files.append(("locales",
134 [os.path.join(cefDir, "locales", "hu.pak"),
135 os.path.join(cefDir, "locales", "en-GB.pak"),
136 os.path.join(cefDir, "locales", "en-US.pak"),
137 os.path.join(cefDir, "locales", "ru.pak")]))
138
139 if os.getenv("WINE")=="yes":
140 winsysdir=os.getenv("WINSYSDIR")
141
142 if gtkRuntimeDir:
143 gtkBinDir = os.path.join(gtkRuntimeDir, "bin")
144 data_files.append(("", [
145 os.path.join(gtkBinDir, "libatk-1.0-0.dll"),
146 os.path.join(gtkBinDir, "libbz2-1.dll"),
147 os.path.join(gtkBinDir, "libcairo-2.dll"),
148 os.path.join(gtkBinDir, "libcairo-gobject-2.dll"),
149 os.path.join(gtkBinDir, "libcroco-0.6-3.dll"),
150 os.path.join(gtkBinDir, "libcrypto-1_1.dll"),
151 os.path.join(gtkBinDir, "libdatrie-1.dll"),
152 os.path.join(gtkBinDir, "libepoxy-0.dll"),
153 os.path.join(gtkBinDir, "libexpat-1.dll"),
154 os.path.join(gtkBinDir, "libexslt-0.dll"),
155 os.path.join(gtkBinDir, "libffi-6.dll"),
156 os.path.join(gtkBinDir, "libfontconfig-1.dll"),
157 os.path.join(gtkBinDir, "libfreetype-6.dll"),
158 os.path.join(gtkBinDir, "libfribidi-0.dll"),
159 os.path.join(gtkBinDir, "libgcc_s_dw2-1.dll"),
160 os.path.join(gtkBinDir, "libgdk_pixbuf-2.0-0.dll"),
161 os.path.join(gtkBinDir, "libgio-2.0-0.dll"),
162 os.path.join(gtkBinDir, "libgirepository-1.0-1.dll"),
163 os.path.join(gtkBinDir, "libglib-2.0-0.dll"),
164 os.path.join(gtkBinDir, "libgmodule-2.0-0.dll"),
165 os.path.join(gtkBinDir, "libgobject-2.0-0.dll"),
166 os.path.join(gtkBinDir, "libgraphite2.dll"),
167 os.path.join(gtkBinDir, "libharfbuzz-0.dll"),
168 os.path.join(gtkBinDir, "libiconv-2.dll"),
169 os.path.join(gtkBinDir, "libintl-8.dll"),
170 os.path.join(gtkBinDir, "liblzma-5.dll"),
171 os.path.join(gtkBinDir, "libmpdec-2.dll"),
172 os.path.join(gtkBinDir, "libpango-1.0-0.dll"),
173 os.path.join(gtkBinDir, "libpangocairo-1.0-0.dll"),
174 os.path.join(gtkBinDir, "libpangoft2-1.0-0.dll"),
175 os.path.join(gtkBinDir, "libpangowin32-1.0-0.dll"),
176 os.path.join(gtkBinDir, "libpcre-1.dll"),
177 os.path.join(gtkBinDir, "libpixman-1-0.dll"),
178 os.path.join(gtkBinDir, "libpng16-16.dll"),
179 os.path.join(gtkBinDir, "librsvg-2-2.dll"),
180 os.path.join(gtkBinDir, "libssl-1_1.dll"),
181 os.path.join(gtkBinDir, "libssp-0.dll"),
182 os.path.join(gtkBinDir, "libstdc++-6.dll"),
183 os.path.join(gtkBinDir, "libthai-0.dll"),
184 os.path.join(gtkBinDir, "libwinpthread-1.dll"),
185 os.path.join(gtkBinDir, "libxml2-2.dll"),
186 os.path.join(gtkBinDir, "libxslt-1.dll"),
187 os.path.join(gtkBinDir, "zlib1.dll"),
188 ]))
189 if cefDir:
190 data_files.append(("", [
191 os.path.join(cefDir, "libcef.dll"),
192 os.path.join(cefDir, "chrome_elf.dll")
193 ]))
194
195 print(data_files)
196
197 with open("mlx-common.nsh", "wt") as f:
198 print('!define MLX_VERSION "%s"' % (mlx.const.VERSION), file=f)
199 f.close()
200else:
201 for (dirpath, dirnames, filenames) in os.walk("patches"):
202 if filenames:
203 filenames = [os.path.join(dirpath, filename)
204 for filename in filenames]
205 data_files.append((dirpath, filenames))
206
207
208long_description="""MAVA Logger X
209
210This is a program to log and evaluate the actions
211of a pilot flying a virtual Malév flight operated
212by MAVA."""
213
214setup(name = "mlx",
215 version = mlx.const.VERSION,
216 description = "MAVA Logger X",
217 long_description = long_description,
218 author = "István Váradi",
219 author_email = "ivaradi@gmail.com",
220 url = "http://mlx.varadiistvan.hu",
221 package_dir = { "" : "src" },
222 packages = ["mlx", "mlx.gui"],
223 requires = ["pyuipc", "xplra"],
224 windows = [{ "script" : "runmlx.py",
225 "icon_resources" : [(1, "logo.ico")],
226 "other_resources": [(RT_MANIFEST, 1, defaultManifest)]},
227 { "script" : "mlxupdate.py",
228 "other_resources": [(RT_MANIFEST, 1, adminManifest)]}],
229 options = { "py2exe" : { "packages" : "gi, lxml",
230 "skip_archive": True} },
231 zipfile = "library",
232 data_files = data_files,
233 platforms = ["Win32", "Linux"],
234 license = "Public Domain"
235 )
236
237if os.name=="nt":
238 mlx.update.buildManifest(os.path.join(scriptdir, "dist"))
239 with open(os.path.join(scriptdir, "dist", "Uninstall.conf"), "wt") as f:
240 print("StartMenuFolder=MAVA Logger X", file=f)
241 print("LinkName=MAVA Logger X", file=f)
Note: See TracBrowser for help on using the repository browser.