forked from otsaloma/gaupol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwinsetup.py
56 lines (47 loc) · 1.8 KB
/
winsetup.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""cx_Freeze installation routines built on top of normal setup.py."""
import glob
import os
import site
os.environ["GAUPOL_FREEZING"] = "1"
from setup import *
import cx_Freeze
includes = ["aeidon", "cairo", "gaupol", "gi"]
include_files = [(os.path.join("build", "usr", "share"), "share")]
site_path = site.getsitepackages()[1]
gnome_path = os.path.join(site_path, "gnome")
for dll in glob.glob("{}/*.dll".format(gnome_path)):
include_files.append((dll, os.path.basename(dll)))
include_files.append((os.path.join(gnome_path, "etc"), "etc"))
include_files.append((os.path.join(gnome_path, "lib"), "lib"))
include_files.append((os.path.join(gnome_path, "share"), "share"))
# PyEnchant ships with DLLs provided by pygi-aio as well.
# Keep the pygio-aio DLLs, but add PyEnchant data files.
enchant_path = os.path.join(site_path, "enchant")
include_files.append((os.path.join(enchant_path, "lib"), "lib"))
include_files.append((os.path.join(enchant_path, "share"), "share"))
setup_kwargs.update(dict(
options=dict(build_exe=dict(
compressed=False,
includes=includes,
packages=includes,
include_files=include_files,
)),
executables=[cx_Freeze.Executable(
script="bin/gaupol",
base="WIN32GUI",
icon="data/icons/gaupol.ico",
)],
))
def patch_build():
# Enable header bars on builtin GTK+ dialogs such as file dialogs,
# assistants, color and font pickers for consistency with Gaupol's
# own dialogs, which use header bars.
path = glob.glob("build/exe.*/etc/gtk-3.0/settings.ini")[0]
print("patching {}".format(path))
with open(path, "a", encoding="us_ascii") as f:
f.write("\ngtk-dialogs-use-header = 1\n")
if __name__ == "__main__":
cx_Freeze.setup(**setup_kwargs)
patch_build()