source: setup.py@ 945:90f458a3bc2d

python3
Last change on this file since 945:90f458a3bc2d was 938:f26db2a00d8a, checked in by István Váradi <ivaradi@…>, 6 years ago

Updated the explicit DLL list in setup.py for Wine (re #347)

File size: 9.4 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
15data_files = [("sounds", glob(os.path.join("sounds", "*.*")))]
16for language in ["en", "hu"]:
17 data_files.append((os.path.join("doc", "manual", language),
18 glob(os.path.join("doc", "manual", language, "*.*"))))
19 data_files.append((os.path.join("locale", language, "LC_MESSAGES"),
20 [os.path.join("locale", language, "LC_MESSAGES",
21 "mlx.mo")]))
22
23rootFiles = ["logo.png", "conn_grey.png", "conn_red.png", "conn_green.png"]
24if os.name!="nt":
25 rootFiles.append("Microsoft.VC90.CRT.manifest")
26data_files.append(("", rootFiles))
27
28if os.name=="nt":
29 import py2exe
30
31 data_files.append(("", ["logo.ico"]))
32
33 msvcrDir = os.environ["MSVCRDIR"] if "MSVCRDIR" in os.environ else None
34 if msvcrDir:
35 data_files.append(("Microsoft.VC90.CRT",
36 ["Microsoft.VC90.CRT.manifest"] +
37 glob(os.path.join(msvcrDir, "*.*"))))
38 os.environ["PATH"] = os.environ["PATH"] + ";" + glob(os.path.join(msvcrDir))[0]
39
40
41 gtkRuntimeDir = os.environ["GTKRTDIR"] if "GTKRTDIR" in os.environ else None
42 if gtkRuntimeDir:
43 if gtkRuntimeDir.endswith("/mingw32"):
44 path = os.path.join("lib", "girepository-1.0")
45 data_files.append((path,
46 glob(os.path.join(gtkRuntimeDir, path, "*"))))
47
48 files = {}
49
50 for components in [ ["lib", "girepository-1.0"],
51 ["lib", "gdk-pixbuf-2.0", "2.10.0"],
52 ["share", "icons"],
53 ["share", "locale", "hu"],
54 ["share", "locale", "en"],
55 ["share", "themes"],
56 ["share", "glib-2.0", "schemas"]]:
57 path = os.path.join(*components)
58 p = Path(os.path.join(gtkRuntimeDir, path))
59 for f in p.glob("**/*"):
60 if f.is_file():
61 d = os.path.join(path, str(f.parent.relative_to(p)))
62 if d in files:
63 files[d].append(str(f))
64 else:
65 files[d] = [str(f)]
66
67 for path in files:
68 data_files.append((path, files[path]))
69 data_files.append(("",
70 [os.path.join(gtkRuntimeDir, "bin", "librsvg-2-2.dll"),
71 os.path.join(gtkRuntimeDir, "bin", "libcroco-0.6-3.dll")]))
72 else:
73 path = os.path.join("lib", "gtk-2.0", "2.10.0", "engines")
74 data_files.append((os.path.join("library", path),
75 [os.path.join(gtkRuntimeDir, path, "libwimp.dll")]))
76
77 path = os.path.join("share", "themes", "MS-Windows", "gtk-2.0")
78 data_files.append((os.path.join("library", path),
79 glob(os.path.join(gtkRuntimeDir, path, "*"))))
80
81 path = os.path.join("share", "locale", "hu", "LC_MESSAGES")
82 data_files.append((os.path.join("library", path),
83 glob(os.path.join(gtkRuntimeDir, path, "*"))))
84 path = os.path.join("share", "icons", "hicolor")
85 data_files.append((os.path.join("library", path),
86 glob(os.path.join(gtkRuntimeDir, path, "*"))))
87
88 cefDir = os.environ.get("CEFDIR")
89 if cefDir:
90 for fileName in ["icudtl.dat", "subprocess.exe", "natives_blob.bin",
91 "snapshot_blob.bin", "v8_context_snapshot.bin",
92 "cef.pak", "cef_100_percent.pak",
93 "cef_200_percent.pak", "cef_extensions.pak"]:
94 data_files.append(("", [os.path.join(cefDir, fileName)]))
95
96 data_files.append(("locales",
97 glob(os.path.join(cefDir, "locales", "*"))))
98
99 if os.getenv("WINE")=="yes":
100 winsysdir=os.getenv("WINSYSDIR")
101
102 if gtkRuntimeDir:
103 gtkBinDir = os.path.join(gtkRuntimeDir, "bin")
104 data_files.append(("", [
105 os.path.join(gtkBinDir, "libatk-1.0-0.dll"),
106 os.path.join(gtkBinDir, "libbz2-1.dll"),
107 os.path.join(gtkBinDir, "libcairo-2.dll"),
108 os.path.join(gtkBinDir, "libcairo-gobject-2.dll"),
109 os.path.join(gtkBinDir, "libcroco-0.6-3.dll"),
110 os.path.join(gtkBinDir, "libcrypto-1_1.dll"),
111 os.path.join(gtkBinDir, "libdatrie-1.dll"),
112 os.path.join(gtkBinDir, "libepoxy-0.dll"),
113 os.path.join(gtkBinDir, "libexpat-1.dll"),
114 os.path.join(gtkBinDir, "libexslt-0.dll"),
115 os.path.join(gtkBinDir, "libffi-6.dll"),
116 os.path.join(gtkBinDir, "libfontconfig-1.dll"),
117 os.path.join(gtkBinDir, "libfreetype-6.dll"),
118 os.path.join(gtkBinDir, "libfribidi-0.dll"),
119 os.path.join(gtkBinDir, "libgcc_s_dw2-1.dll"),
120 os.path.join(gtkBinDir, "libgdk_pixbuf-2.0-0.dll"),
121 os.path.join(gtkBinDir, "libgio-2.0-0.dll"),
122 os.path.join(gtkBinDir, "libgirepository-1.0-1.dll"),
123 os.path.join(gtkBinDir, "libglib-2.0-0.dll"),
124 os.path.join(gtkBinDir, "libgmodule-2.0-0.dll"),
125 os.path.join(gtkBinDir, "libgobject-2.0-0.dll"),
126 os.path.join(gtkBinDir, "libgraphite2.dll"),
127 os.path.join(gtkBinDir, "libharfbuzz-0.dll"),
128 os.path.join(gtkBinDir, "libiconv-2.dll"),
129 os.path.join(gtkBinDir, "libintl-8.dll"),
130 os.path.join(gtkBinDir, "liblzma-5.dll"),
131 os.path.join(gtkBinDir, "libmpdec-2.dll"),
132 os.path.join(gtkBinDir, "libpango-1.0-0.dll"),
133 os.path.join(gtkBinDir, "libpangocairo-1.0-0.dll"),
134 os.path.join(gtkBinDir, "libpangoft2-1.0-0.dll"),
135 os.path.join(gtkBinDir, "libpangowin32-1.0-0.dll"),
136 os.path.join(gtkBinDir, "libpcre-1.dll"),
137 os.path.join(gtkBinDir, "libpixman-1-0.dll"),
138 os.path.join(gtkBinDir, "libpng16-16.dll"),
139 os.path.join(gtkBinDir, "librsvg-2-2.dll"),
140 os.path.join(gtkBinDir, "libssl-1_1.dll"),
141 os.path.join(gtkBinDir, "libssp-0.dll"),
142 os.path.join(gtkBinDir, "libstdc++-6.dll"),
143 os.path.join(gtkBinDir, "libthai-0.dll"),
144 os.path.join(gtkBinDir, "libwinpthread-1.dll"),
145 os.path.join(gtkBinDir, "libxml2-2.dll"),
146 os.path.join(gtkBinDir, "libxslt-1.dll"),
147 os.path.join(gtkBinDir, "zlib1.dll"),
148 ]))
149 if cefDir:
150 data_files.append(("", [
151 os.path.join(cefDir, "libcef.dll"),
152 os.path.join(cefDir, "chrome_elf.dll")
153 ]))
154
155 print(data_files)
156
157 with open("mlx-common.nsh", "wt") as f:
158 print('!define MLX_VERSION "%s"' % (mlx.const.VERSION), file=f)
159 f.close()
160else:
161 for (dirpath, dirnames, filenames) in os.walk("patches"):
162 if filenames:
163 filenames = [os.path.join(dirpath, filename)
164 for filename in filenames]
165 data_files.append((dirpath, filenames))
166
167
168long_description="""MAVA Logger X
169
170This is a program to log and evaluate the actions
171of a pilot flying a virtual Malév flight operated
172by MAVA."""
173
174setup(name = "mlx",
175 version = mlx.const.VERSION,
176 description = "MAVA Logger X",
177 long_description = long_description,
178 author = "István Váradi",
179 author_email = "ivaradi@gmail.com",
180 url = "http://mlx.varadiistvan.hu",
181 package_dir = { "" : "src" },
182 packages = ["mlx", "mlx.gui"],
183 requires = ["pyuipc", "xplra"],
184 windows = [{ "script" : "runmlx.py",
185 "icon_resources" : [(1, "logo.ico")]},
186 { "script" : "mlxupdate.py",
187 "uac_info" : "requireAdministrator"}],
188 options = { "py2exe" : { "packages" : "gi, lxml",
189 "skip_archive": True} },
190 zipfile = "library",
191 data_files = data_files,
192 platforms = ["Win32", "Linux"],
193 license = "Public Domain"
194 )
195
196if os.name=="nt":
197 mlx.update.buildManifest(os.path.join(scriptdir, "dist"))
198 with open(os.path.join(scriptdir, "dist", "Uninstall.conf"), "wt") as f:
199 print("StartMenuFolder=MAVA Logger X", file=f)
200 print("LinkName=MAVA Logger X", file=f)
Note: See TracBrowser for help on using the repository browser.