Attachment 'setup.py'
Download 1 import os, site, sys
2 from cx_Freeze import setup, Executable
3
4 ## Get the site-package folder, not everybody will install
5 ## Python into C:\PythonXX
6 site_dir = site.getsitepackages()[1]
7 include_dll_path = os.path.join(site_dir, "gtk")
8
9 ## Collect the list of missing dll when cx_freeze builds the app
10 missing_dll = ['libgtk-3-0.dll',
11 'libgdk-3-0.dll',
12 'libatk-1.0-0.dll',
13 'libcairo-gobject-2.dll',
14 'libgdk_pixbuf-2.0-0.dll',
15 'libjpeg-8.dll',
16 'libpango-1.0-0.dll',
17 'libpangocairo-1.0-0.dll',
18 'libpangoft2-1.0-0.dll',
19 'libpangowin32-1.0-0.dll',
20 'libgnutls-26.dll',
21 'libgcrypt-11.dll',
22 'libp11-kit-0.dll'
23 ]
24
25 ## We also need to add the glade folder, cx_freeze will walk
26 ## into it and copy all the necessary files
27 glade_folder = 'glade'
28
29 ## We need to add all the libraries too (for themes, etc..)
30 gtk_libs = ['etc', 'lib', 'share']
31
32 ## Create the list of includes as cx_freeze likes
33 include_files = []
34 for dll in missing_dll:
35 include_files.append((os.path.join(include_dll_path, dll), dll))
36
37 ## Let's add glade folder and files
38 include_files.append((glade_folder, glade_folder))
39
40 ## Let's add gtk libraries folders and files
41 for lib in gtk_libs:
42 include_files.append((os.path.join(include_dll_path, lib), lib))
43
44 base = None
45
46 ## Lets not open the console while running the app
47 if sys.platform == "win32":
48 base = "Win32GUI"
49
50 executables = [
51 Executable("main.py",
52 base=base
53 )
54 ]
55
56 buildOptions = dict(
57 compressed = False,
58 includes = ["gi"],
59 packages = ["gi"],
60 include_files = include_files
61 )
62
63 setup(
64 name = "test_gtk3_app",
65 author = "Gian Mario Tagliaretti",
66 version = "1.0",
67 description = "GTK 3 test",
68 options = dict(build_exe = buildOptions),
69 executables = executables
70 )
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.