1 | # -*- coding: iso-8859-2 -*-
|
---|
2 |
|
---|
3 | import sys
|
---|
4 | import os
|
---|
5 | from glob import glob
|
---|
6 | from distutils.core import setup
|
---|
7 |
|
---|
8 | scriptdir=os.path.dirname(sys.argv[0])
|
---|
9 | sys.path.insert(0, os.path.join(scriptdir, "src"))
|
---|
10 |
|
---|
11 | import mlx.const
|
---|
12 | import mlx.update
|
---|
13 |
|
---|
14 | data_files = [("sounds", glob(os.path.join("sounds", "*.*")))]
|
---|
15 | for language in ["en", "hu"]:
|
---|
16 | data_files.append((os.path.join("doc", "manual", language),
|
---|
17 | glob(os.path.join("doc", "manual", language, "*.*"))))
|
---|
18 | data_files.append((os.path.join("locale", language, "LC_MESSAGES"),
|
---|
19 | [os.path.join("locale", language, "LC_MESSAGES",
|
---|
20 | "mlx.mo")]))
|
---|
21 |
|
---|
22 | rootFiles = ["logo.png", "conn_grey.png", "conn_red.png", "conn_green.png"]
|
---|
23 | if os.name!="nt":
|
---|
24 | rootFiles.append("Microsoft.VC90.CRT.manifest")
|
---|
25 | data_files.append(("", rootFiles))
|
---|
26 |
|
---|
27 | if os.name=="nt":
|
---|
28 | import py2exe
|
---|
29 |
|
---|
30 | data_files.append(("", ["logo.ico"]))
|
---|
31 |
|
---|
32 | msvcrDir = os.environ["MSVCRDIR"] if "MSVCRDIR" in os.environ else None
|
---|
33 | if msvcrDir:
|
---|
34 | data_files.append(("Microsoft.VC90.CRT",
|
---|
35 | ["Microsoft.VC90.CRT.manifest"] +
|
---|
36 | glob(os.path.join(msvcrDir, "*.*"))))
|
---|
37 | os.environ["PATH"] = os.environ["PATH"] + ";" + glob(os.path.join(msvcrDir))[0]
|
---|
38 |
|
---|
39 |
|
---|
40 | gtkRuntimeDir = os.environ["GTKRTDIR"] if "GTKRTDIR" in os.environ else None
|
---|
41 | if gtkRuntimeDir:
|
---|
42 | path = os.path.join("lib", "gtk-2.0", "2.10.0", "engines")
|
---|
43 | data_files.append((os.path.join("library", path),
|
---|
44 | [os.path.join(gtkRuntimeDir, path, "libwimp.dll")]))
|
---|
45 |
|
---|
46 | path = os.path.join("share", "themes", "MS-Windows", "gtk-2.0")
|
---|
47 | data_files.append((os.path.join("library", path),
|
---|
48 | glob(os.path.join(gtkRuntimeDir, path, "*"))))
|
---|
49 |
|
---|
50 | path = os.path.join("share", "locale", "hu", "LC_MESSAGES")
|
---|
51 | data_files.append((os.path.join("library", path),
|
---|
52 | glob(os.path.join(gtkRuntimeDir, path, "*"))))
|
---|
53 | path = os.path.join("share", "icons", "hicolor")
|
---|
54 | data_files.append((os.path.join("library", path),
|
---|
55 | glob(os.path.join(gtkRuntimeDir, path, "*"))))
|
---|
56 |
|
---|
57 | cefDir = os.environ.get("CEFDIR")
|
---|
58 | if cefDir:
|
---|
59 | for fileName in ["icudt.dll", "subprocess.exe"]:
|
---|
60 | data_files.append(("", [os.path.join(cefDir, fileName)]))
|
---|
61 |
|
---|
62 | data_files.append(("locales",
|
---|
63 | glob(os.path.join(cefDir, "locales", "*"))))
|
---|
64 |
|
---|
65 | if os.getenv("WINE")=="yes":
|
---|
66 | winsysdir=os.getenv("WINSYSDIR")
|
---|
67 | data_files.append(("", [os.path.join(winsysdir, "python27.dll")]))
|
---|
68 | data_files.append(("library", [
|
---|
69 | os.path.join(winsysdir, "pywintypes27.dll"),
|
---|
70 | os.path.join(winsysdir, "WINHTTP.dll")]))
|
---|
71 |
|
---|
72 | if gtkRuntimeDir:
|
---|
73 | gtkBinDir = os.path.join(gtkRuntimeDir, "bin")
|
---|
74 | data_files.append(("library", [
|
---|
75 | os.path.join(gtkBinDir, "freetype6.dll"),
|
---|
76 | os.path.join(gtkBinDir, "intl.dll"),
|
---|
77 | os.path.join(gtkBinDir, "zlib1.dll"),
|
---|
78 | os.path.join(gtkBinDir, "libglib-2.0-0.dll"),
|
---|
79 | os.path.join(gtkBinDir, "libatk-1.0-0.dll"),
|
---|
80 | os.path.join(gtkBinDir, "libcairo-2.dll"),
|
---|
81 | os.path.join(gtkBinDir, "libexpat-1.dll"),
|
---|
82 | os.path.join(gtkBinDir, "libpangowin32-1.0-0.dll"),
|
---|
83 | os.path.join(gtkBinDir, "libgio-2.0-0.dll"),
|
---|
84 | os.path.join(gtkBinDir, "libgdk-win32-2.0-0.dll"),
|
---|
85 | os.path.join(gtkBinDir, "libpng14-14.dll"),
|
---|
86 | os.path.join(gtkBinDir, "libgobject-2.0-0.dll"),
|
---|
87 | os.path.join(gtkBinDir, "libgdk_pixbuf-2.0-0.dll"),
|
---|
88 | os.path.join(gtkBinDir, "libfontconfig-1.dll"),
|
---|
89 | os.path.join(gtkBinDir, "libpangoft2-1.0-0.dll"),
|
---|
90 | os.path.join(gtkBinDir, "libgmodule-2.0-0.dll"),
|
---|
91 | os.path.join(gtkBinDir, "libpango-1.0-0.dll"),
|
---|
92 | os.path.join(gtkBinDir, "libpangocairo-1.0-0.dll"),
|
---|
93 | os.path.join(gtkBinDir, "libgtk-win32-2.0-0.dll"),
|
---|
94 | os.path.join(gtkBinDir, "libgthread-2.0-0.dll")
|
---|
95 | ]))
|
---|
96 | if cefDir:
|
---|
97 | data_files.append(("library", [
|
---|
98 | os.path.join(cefDir, "libcef.dll")
|
---|
99 | ]))
|
---|
100 |
|
---|
101 | print(data_files)
|
---|
102 |
|
---|
103 | with open("mlx-common.nsh", "wt") as f:
|
---|
104 | print('!define MLX_VERSION "%s"' % (mlx.const.VERSION), file=f)
|
---|
105 | f.close()
|
---|
106 | else:
|
---|
107 | for (dirpath, dirnames, filenames) in os.walk("patches"):
|
---|
108 | if filenames:
|
---|
109 | filenames = [os.path.join(dirpath, filename)
|
---|
110 | for filename in filenames]
|
---|
111 | data_files.append((dirpath, filenames))
|
---|
112 |
|
---|
113 |
|
---|
114 | long_description="""MAVA Logger X
|
---|
115 |
|
---|
116 | This is a program to log and evaluate the actions
|
---|
117 | of a pilot flying a virtual Malév flight operated
|
---|
118 | by MAVA."""
|
---|
119 |
|
---|
120 | setup(name = "mlx",
|
---|
121 | version = mlx.const.VERSION,
|
---|
122 | description = "MAVA Logger X",
|
---|
123 | long_description = long_description,
|
---|
124 | author = "István Váradi",
|
---|
125 | author_email = "ivaradi@gmail.com",
|
---|
126 | url = "http://mlx.varadiistvan.hu",
|
---|
127 | package_dir = { "" : "src" },
|
---|
128 | packages = ["mlx", "mlx.gui"],
|
---|
129 | requires = ["pyuipc", "xplra"],
|
---|
130 | windows = [{ "script" : "runmlx.py",
|
---|
131 | "icon_resources" : [(1, "logo.ico")]},
|
---|
132 | { "script" : "mlxupdate.py",
|
---|
133 | "uac_info" : "requireAdministrator"}],
|
---|
134 | options = { "py2exe" : { "includes": "gio, pango, atk, pangocairo, lxml._elementpath",
|
---|
135 | "skip_archive": True} },
|
---|
136 | zipfile = "library/.",
|
---|
137 | data_files = data_files,
|
---|
138 | platforms = ["Win32", "Linux"],
|
---|
139 | license = "Public Domain"
|
---|
140 | )
|
---|
141 |
|
---|
142 | if os.name=="nt":
|
---|
143 | os.rename(os.path.join(scriptdir, "dist", "library", "libcef.dll"),
|
---|
144 | os.path.join(scriptdir, "dist", "libcef.dll"))
|
---|
145 | mlx.update.buildManifest(os.path.join(scriptdir, "dist"))
|
---|
146 | with open(os.path.join(scriptdir, "dist", "Uninstall.conf"), "wt") as f:
|
---|
147 | print("StartMenuFolder=MAVA Logger X", file=f)
|
---|
148 | print("LinkName=MAVA Logger X", file=f)
|
---|