[20] | 1 | # -*- coding: iso-8859-2 -*-
|
---|
| 2 |
|
---|
| 3 | import sys
|
---|
| 4 | import os
|
---|
| 5 | from glob import glob
|
---|
| 6 | from distutils.core import setup
|
---|
[935] | 7 | from pathlib import Path
|
---|
[20] | 8 |
|
---|
[37] | 9 | scriptdir=os.path.dirname(sys.argv[0])
|
---|
| 10 | sys.path.insert(0, os.path.join(scriptdir, "src"))
|
---|
[20] | 11 |
|
---|
[27] | 12 | import mlx.const
|
---|
[37] | 13 | import mlx.update
|
---|
[20] | 14 |
|
---|
[947] | 15 | defaultManifest="""<?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 |
|
---|
| 40 | adminManifest=defaultManifest.replace("asInvoker", "requireAdministrator")
|
---|
| 41 |
|
---|
| 42 | RT_MANIFEST=24
|
---|
| 43 |
|
---|
[137] | 44 | data_files = [("sounds", glob(os.path.join("sounds", "*.*")))]
|
---|
[287] | 45 | for 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")]))
|
---|
[875] | 51 |
|
---|
[1046] | 52 | rootFiles = ["logo.png", "conn_grey.png", "conn_red.png", "conn_green.png",
|
---|
[1181] | 53 | "mavalogo.png", "fleet.json", "gates.json", "bugreport.txt"]
|
---|
[875] | 54 | if os.name!="nt":
|
---|
| 55 | rootFiles.append("Microsoft.VC90.CRT.manifest")
|
---|
| 56 | data_files.append(("", rootFiles))
|
---|
[682] | 57 |
|
---|
[20] | 58 | if os.name=="nt":
|
---|
| 59 | import py2exe
|
---|
| 60 |
|
---|
[28] | 61 | data_files.append(("", ["logo.ico"]))
|
---|
[27] | 62 |
|
---|
[20] | 63 | msvcrDir = os.environ["MSVCRDIR"] if "MSVCRDIR" in os.environ else None
|
---|
| 64 | if msvcrDir:
|
---|
[875] | 65 | data_files.append(("Microsoft.VC90.CRT",
|
---|
| 66 | ["Microsoft.VC90.CRT.manifest"] +
|
---|
| 67 | glob(os.path.join(msvcrDir, "*.*"))))
|
---|
[653] | 68 | os.environ["PATH"] = os.environ["PATH"] + ";" + glob(os.path.join(msvcrDir))[0]
|
---|
[20] | 69 |
|
---|
| 70 | gtkRuntimeDir = os.environ["GTKRTDIR"] if "GTKRTDIR" in os.environ else None
|
---|
| 71 | if gtkRuntimeDir:
|
---|
[935] | 72 | if gtkRuntimeDir.endswith("/mingw32"):
|
---|
| 73 | files = {}
|
---|
[20] | 74 |
|
---|
[935] | 75 | for components in [ ["lib", "girepository-1.0"],
|
---|
[981] | 76 | ["lib", "gdk-pixbuf-2.0", "2.10.0", "loaders.cache"],
|
---|
| 77 | ["lib", "gdk-pixbuf-2.0", "2.10.0", "loaders", "libpixbufloader-ico.dll"],
|
---|
| 78 | ["lib", "gdk-pixbuf-2.0", "2.10.0", "loaders", "libpixbufloader-png.dll"],
|
---|
| 79 | ["lib", "gdk-pixbuf-2.0", "2.10.0", "loaders", "libpixbufloader-svg.dll"],
|
---|
| 80 | ["share", "icons", "Adwaita", "icon-theme.cache"],
|
---|
| 81 | ["share", "icons", "Adwaita", "index.theme"],
|
---|
| 82 | ["share", "icons", "Adwaita", "16x16"],
|
---|
[1030] | 83 | ["share", "icons", "Adwaita", "scalable"],
|
---|
[935] | 84 | ["share", "locale", "hu"],
|
---|
| 85 | ["share", "locale", "en"],
|
---|
| 86 | ["share", "themes"],
|
---|
| 87 | ["share", "glib-2.0", "schemas"]]:
|
---|
[981] | 88 | path = os.path.join(*components)
|
---|
| 89 | p = Path(os.path.join(gtkRuntimeDir, path))
|
---|
| 90 | if p.is_file():
|
---|
| 91 | d = os.path.dirname(path)
|
---|
| 92 | if d in files:
|
---|
| 93 | files[d].append(str(p))
|
---|
| 94 | else:
|
---|
| 95 | files[d] = [str(p)]
|
---|
| 96 | else:
|
---|
| 97 | for f in p.glob("**/*"):
|
---|
| 98 | if f.is_file():
|
---|
| 99 | d = os.path.join(path, str(f.parent.relative_to(p)))
|
---|
| 100 | if d in files:
|
---|
| 101 | files[d].append(str(f))
|
---|
| 102 | else:
|
---|
| 103 | files[d] = [str(f)]
|
---|
[373] | 104 |
|
---|
[935] | 105 | for path in files:
|
---|
| 106 | data_files.append((path, files[path]))
|
---|
| 107 | data_files.append(("",
|
---|
| 108 | [os.path.join(gtkRuntimeDir, "bin", "librsvg-2-2.dll"),
|
---|
| 109 | os.path.join(gtkRuntimeDir, "bin", "libcroco-0.6-3.dll")]))
|
---|
| 110 | else:
|
---|
| 111 | path = os.path.join("lib", "gtk-2.0", "2.10.0", "engines")
|
---|
| 112 | data_files.append((os.path.join("library", path),
|
---|
| 113 | [os.path.join(gtkRuntimeDir, path, "libwimp.dll")]))
|
---|
| 114 |
|
---|
| 115 | path = os.path.join("share", "themes", "MS-Windows", "gtk-2.0")
|
---|
| 116 | data_files.append((os.path.join("library", path),
|
---|
| 117 | glob(os.path.join(gtkRuntimeDir, path, "*"))))
|
---|
| 118 |
|
---|
| 119 | path = os.path.join("share", "locale", "hu", "LC_MESSAGES")
|
---|
| 120 | data_files.append((os.path.join("library", path),
|
---|
| 121 | glob(os.path.join(gtkRuntimeDir, path, "*"))))
|
---|
| 122 | path = os.path.join("share", "icons", "hicolor")
|
---|
| 123 | data_files.append((os.path.join("library", path),
|
---|
| 124 | glob(os.path.join(gtkRuntimeDir, path, "*"))))
|
---|
[373] | 125 |
|
---|
[653] | 126 | cefDir = os.environ.get("CEFDIR")
|
---|
| 127 | if cefDir:
|
---|
[1083] | 128 | for fileName in ["icudtl.dat", "subprocess.exe",
|
---|
[935] | 129 | "snapshot_blob.bin", "v8_context_snapshot.bin",
|
---|
[1083] | 130 | "chrome_100_percent.pak", "chrome_200_percent.pak",
|
---|
| 131 | "resources.pak"]:
|
---|
[653] | 132 | data_files.append(("", [os.path.join(cefDir, fileName)]))
|
---|
| 133 |
|
---|
| 134 | data_files.append(("locales",
|
---|
[981] | 135 | [os.path.join(cefDir, "locales", "hu.pak"),
|
---|
| 136 | os.path.join(cefDir, "locales", "en-GB.pak"),
|
---|
| 137 | os.path.join(cefDir, "locales", "en-US.pak"),
|
---|
| 138 | os.path.join(cefDir, "locales", "ru.pak")]))
|
---|
[653] | 139 |
|
---|
[916] | 140 | if os.getenv("WINE")=="yes":
|
---|
| 141 | winsysdir=os.getenv("WINSYSDIR")
|
---|
| 142 |
|
---|
| 143 | if gtkRuntimeDir:
|
---|
| 144 | gtkBinDir = os.path.join(gtkRuntimeDir, "bin")
|
---|
[938] | 145 | data_files.append(("", [
|
---|
[916] | 146 | os.path.join(gtkBinDir, "libatk-1.0-0.dll"),
|
---|
[938] | 147 | os.path.join(gtkBinDir, "libbz2-1.dll"),
|
---|
[916] | 148 | os.path.join(gtkBinDir, "libcairo-2.dll"),
|
---|
[938] | 149 | os.path.join(gtkBinDir, "libcairo-gobject-2.dll"),
|
---|
| 150 | os.path.join(gtkBinDir, "libcroco-0.6-3.dll"),
|
---|
| 151 | os.path.join(gtkBinDir, "libcrypto-1_1.dll"),
|
---|
| 152 | os.path.join(gtkBinDir, "libdatrie-1.dll"),
|
---|
| 153 | os.path.join(gtkBinDir, "libepoxy-0.dll"),
|
---|
[916] | 154 | os.path.join(gtkBinDir, "libexpat-1.dll"),
|
---|
[938] | 155 | os.path.join(gtkBinDir, "libexslt-0.dll"),
|
---|
| 156 | os.path.join(gtkBinDir, "libffi-6.dll"),
|
---|
| 157 | os.path.join(gtkBinDir, "libfontconfig-1.dll"),
|
---|
| 158 | os.path.join(gtkBinDir, "libfreetype-6.dll"),
|
---|
| 159 | os.path.join(gtkBinDir, "libfribidi-0.dll"),
|
---|
| 160 | os.path.join(gtkBinDir, "libgcc_s_dw2-1.dll"),
|
---|
| 161 | os.path.join(gtkBinDir, "libgdk_pixbuf-2.0-0.dll"),
|
---|
[916] | 162 | os.path.join(gtkBinDir, "libgio-2.0-0.dll"),
|
---|
[938] | 163 | os.path.join(gtkBinDir, "libgirepository-1.0-1.dll"),
|
---|
| 164 | os.path.join(gtkBinDir, "libglib-2.0-0.dll"),
|
---|
| 165 | os.path.join(gtkBinDir, "libgmodule-2.0-0.dll"),
|
---|
[916] | 166 | os.path.join(gtkBinDir, "libgobject-2.0-0.dll"),
|
---|
[938] | 167 | os.path.join(gtkBinDir, "libgraphite2.dll"),
|
---|
| 168 | os.path.join(gtkBinDir, "libharfbuzz-0.dll"),
|
---|
| 169 | os.path.join(gtkBinDir, "libiconv-2.dll"),
|
---|
| 170 | os.path.join(gtkBinDir, "libintl-8.dll"),
|
---|
| 171 | os.path.join(gtkBinDir, "liblzma-5.dll"),
|
---|
| 172 | os.path.join(gtkBinDir, "libmpdec-2.dll"),
|
---|
[916] | 173 | os.path.join(gtkBinDir, "libpango-1.0-0.dll"),
|
---|
| 174 | os.path.join(gtkBinDir, "libpangocairo-1.0-0.dll"),
|
---|
[938] | 175 | os.path.join(gtkBinDir, "libpangoft2-1.0-0.dll"),
|
---|
| 176 | os.path.join(gtkBinDir, "libpangowin32-1.0-0.dll"),
|
---|
| 177 | os.path.join(gtkBinDir, "libpcre-1.dll"),
|
---|
| 178 | os.path.join(gtkBinDir, "libpixman-1-0.dll"),
|
---|
| 179 | os.path.join(gtkBinDir, "libpng16-16.dll"),
|
---|
| 180 | os.path.join(gtkBinDir, "librsvg-2-2.dll"),
|
---|
| 181 | os.path.join(gtkBinDir, "libssl-1_1.dll"),
|
---|
| 182 | os.path.join(gtkBinDir, "libssp-0.dll"),
|
---|
| 183 | os.path.join(gtkBinDir, "libstdc++-6.dll"),
|
---|
| 184 | os.path.join(gtkBinDir, "libthai-0.dll"),
|
---|
| 185 | os.path.join(gtkBinDir, "libwinpthread-1.dll"),
|
---|
| 186 | os.path.join(gtkBinDir, "libxml2-2.dll"),
|
---|
| 187 | os.path.join(gtkBinDir, "libxslt-1.dll"),
|
---|
| 188 | os.path.join(gtkBinDir, "zlib1.dll"),
|
---|
[916] | 189 | ]))
|
---|
| 190 | if cefDir:
|
---|
[938] | 191 | data_files.append(("", [
|
---|
| 192 | os.path.join(cefDir, "libcef.dll"),
|
---|
| 193 | os.path.join(cefDir, "chrome_elf.dll")
|
---|
[916] | 194 | ]))
|
---|
| 195 |
|
---|
[919] | 196 | print(data_files)
|
---|
[653] | 197 |
|
---|
[20] | 198 | with open("mlx-common.nsh", "wt") as f:
|
---|
[919] | 199 | print('!define MLX_VERSION "%s"' % (mlx.const.VERSION), file=f)
|
---|
[20] | 200 | f.close()
|
---|
[682] | 201 | else:
|
---|
| 202 | for (dirpath, dirnames, filenames) in os.walk("patches"):
|
---|
| 203 | if filenames:
|
---|
| 204 | filenames = [os.path.join(dirpath, filename)
|
---|
| 205 | for filename in filenames]
|
---|
| 206 | data_files.append((dirpath, filenames))
|
---|
| 207 |
|
---|
| 208 |
|
---|
[20] | 209 | long_description="""MAVA Logger X
|
---|
| 210 |
|
---|
| 211 | This is a program to log and evaluate the actions
|
---|
| 212 | of a pilot flying a virtual Malév flight operated
|
---|
| 213 | by MAVA."""
|
---|
| 214 |
|
---|
| 215 | setup(name = "mlx",
|
---|
[27] | 216 | version = mlx.const.VERSION,
|
---|
[20] | 217 | description = "MAVA Logger X",
|
---|
| 218 | long_description = long_description,
|
---|
| 219 | author = "István Váradi",
|
---|
| 220 | author_email = "ivaradi@gmail.com",
|
---|
| 221 | url = "http://mlx.varadiistvan.hu",
|
---|
| 222 | package_dir = { "" : "src" },
|
---|
[28] | 223 | packages = ["mlx", "mlx.gui"],
|
---|
[497] | 224 | requires = ["pyuipc", "xplra"],
|
---|
[27] | 225 | windows = [{ "script" : "runmlx.py",
|
---|
[947] | 226 | "icon_resources" : [(1, "logo.ico")],
|
---|
| 227 | "other_resources": [(RT_MANIFEST, 1, defaultManifest)]},
|
---|
[36] | 228 | { "script" : "mlxupdate.py",
|
---|
[947] | 229 | "other_resources": [(RT_MANIFEST, 1, adminManifest)]}],
|
---|
[935] | 230 | options = { "py2exe" : { "packages" : "gi, lxml",
|
---|
[37] | 231 | "skip_archive": True} },
|
---|
[935] | 232 | zipfile = "library",
|
---|
[20] | 233 | data_files = data_files,
|
---|
| 234 | platforms = ["Win32", "Linux"],
|
---|
| 235 | license = "Public Domain"
|
---|
| 236 | )
|
---|
[37] | 237 |
|
---|
| 238 | if os.name=="nt":
|
---|
| 239 | mlx.update.buildManifest(os.path.join(scriptdir, "dist"))
|
---|
[378] | 240 | with open(os.path.join(scriptdir, "dist", "Uninstall.conf"), "wt") as f:
|
---|
[919] | 241 | print("StartMenuFolder=MAVA Logger X", file=f)
|
---|
| 242 | print("LinkName=MAVA Logger X", file=f)
|
---|