-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_old_xp.py
125 lines (95 loc) · 3.85 KB
/
setup_old_xp.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# ======================================================== #
# File automagically generated by GUI2Exe version 0.134.1
# Copyright: (c) 2007-2011 Andrea Gavana
# ======================================================== #
# Let's start with some default (for me) imports...
from distutils.core import setup
from py2exe.build_exe import py2exe
import shutil
# Remove the build folder
shutil.rmtree("build", ignore_errors=True)
class Target(object):
""" A simple class that holds information on our executable file. """
def __init__(self, **kw):
""" Default class constructor. Update as you need. """
self.__dict__.update(kw)
# Ok, let's explain why I am doing that.
# Often, data_files, excludes and dll_excludes (but also resources)
# can be very long list of things, and this will clutter too much
# the setup call at the end of this file. So, I put all the big lists
# here and I wrap them using the textwrap module.
data_files = []
includes = ['email','PyQt4.QtNetwork', 'sip','cffi','_cffi_backend']
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter']
packages = ['sip']
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
'tk84.dll','w9xpopen.exe']
icon_resources = [(1, 'z:\\source\\ctrl\\tools.ico')]
bitmap_resources = []
other_resources = []
# This is a place where the user custom code may go. You can do almost
# whatever you want, even modify the data_files, includes and friends
# here as long as they have the same variable name that the setup call
# below is expecting.
# No custom code added
# Ok, now we are going to build our target class.
# I chose this building strategy as it works perfectly for me :-D
GUI2Exe_Target_1 = Target(
# what to build
script = "main.py",
icon_resources = icon_resources,
bitmap_resources = bitmap_resources,
other_resources = other_resources,
dest_base = "tech",
version = "3.0",
company_name = "Espiridiao, Lda.",
copyright = "Espiridiao, Lda",
name = "C.T.R.L.",
)
# No custom class for UPX compression or Inno Setup script
# That's serious now: we have all (or almost all) the options py2exe
# supports. I put them all even if some of them are usually defaulted
# and not used. Some of them I didn't even know about.
setup(
# No UPX or Inno Setup
data_files = data_files,
options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 3,
"dist_dir": "C:\\bin\\ctrl",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
zipfile = r'library.zip',
console = [],
windows = [GUI2Exe_Target_1],
service = [],
com_server = [],
ctypes_com_server = [], requires=['PyQt4']
)
#
# para consola
#console = [GUI2Exe_Target_1],
# This is a place where any post-compile code may go.
# You can add as much code as you want, which can be used, for example,
# to clean up your folders or to do some particular post-compilation
# actions.
# No post-compilation code added
import shutil
import glob
shutil.rmtree('z:\\source\\ctrl\\build')
dest_dir = "C:\\bin\\ctrl"
for n in glob.glob(r'z:\\source\\ctrl\\*.png'):
shutil.copy(n, dest_dir)
shutil.copy('z:\\source\\ctrl\\_bio.dll', dest_dir)
# shutil.copy('C:\\Python27\\Lib\\site-packages\\certifi\\cacert.pem', dest_dir)
# And we are done. That's a setup script :-D