forked from py2exe/py2exe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
185 lines (154 loc) · 6.92 KB
/
setup.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/usr/bin/python3.3
# -*- coding: utf-8 -*-
"""setup script for py2exe.
"""
import os
import sys
if sys.version_info < (3, 3):
raise RuntimeError("This package requires Python 3.3 or later")
############################################################################
from setuptools import setup
##from distutils.core import setup
from py2exe.py2exe_distutils import Dist, Interpreter, BuildInterpreters
############################################################################
def _is_debug_build():
import imp
for ext, _, _ in imp.get_suffixes():
if ext == "_d.pyd":
return True
return False
if _is_debug_build():
macros = [("PYTHONDLL", '\\"python%d%d_d.dll\\"' % sys.version_info[:2]),
## ("PYTHONCOM", '\\"pythoncom%d%d_d.dll\\"' % sys.version_info[:2]),
("_CRT_SECURE_NO_WARNINGS", '1')]
else:
macros = [("PYTHONDLL", '\\"python%d%d.dll\\"' % sys.version_info[:2]),
## ("PYTHONCOM", '\\"pythoncom%d%d.dll\\"' % sys.version_info[:2]),
("_CRT_SECURE_NO_WARNINGS", '1'),]
macros.append(("Py_BUILD_CORE", '1'))
extra_compile_args = []
extra_link_args = []
extra_compile_args.append("-IC:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Include")
extra_compile_args.append("-IC:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include")
extra_compile_args.append("-IC:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10586.0\\ucrt")
if 0:
# enable this to debug a release build
extra_compile_args.append("/Od")
extra_compile_args.append("/Z7")
extra_link_args.append("/DEBUG")
macros.append(("VERBOSE", "1"))
run_ctypes_dll = Interpreter("py2exe.run_ctypes_dll",
["source/run_ctypes_dll.c",
"source/start.c",
"source/icon.rc",
"source/MemoryModule.c",
"source/MyLoadLibrary.c",
"source/_memimporter.c",
"source/actctx.c",
"source/python-dynload.c",
],
libraries=["user32", "shell32"],
export_symbols=["DllCanUnloadNow,PRIVATE",
"DllGetClassObject,PRIVATE",
"DllRegisterServer,PRIVATE",
"DllUnregisterServer,PRIVATE",
],
target_desc = "shared_library",
define_macros=macros,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args + ["/DLL"],
)
run = Interpreter("py2exe.run",
["source/run.c",
"source/start.c",
"source/icon.rc",
"source/MemoryModule.c",
"source/MyLoadLibrary.c",
"source/_memimporter.c",
"source/actctx.c",
"source/python-dynload.c",
],
libraries=["user32", "shell32"],
define_macros=macros,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
)
run_w = Interpreter("py2exe.run_w",
["source/run_w.c",
"source/start.c",
"source/icon.rc",
"source/MemoryModule.c",
"source/MyLoadLibrary.c",
"source/_memimporter.c",
"source/actctx.c",
"source/python-dynload.c",
],
libraries=["user32", "shell32"],
define_macros=macros,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
)
# The py2exe.resources name is special handled in BuildInterpreters;
# it will not include the python version and platform name. The final
# name will be 'resources.dll'.
#
# This is a resource only dll, so it needs no entry point.
#
# It seems that on SOME systems resources cannot be added correctly to
# this DLL when there are no resources in the dll initially; so for
# simplicity add the py2exe-icon.
resource_dll = Interpreter("py2exe.resources",
["source/dll.c",
"source/icon.rc"],
target_desc = "shared_library",
extra_link_args=["/DLL"],
)
interpreters = [run, run_w, resource_dll,
run_ctypes_dll]
if __name__ == "__main__":
import py2exe
cmdclass = {'build_interpreters': BuildInterpreters}
setup(name="py2exe",
version=py2exe.__version__,
description="Build standalone executables for Windows (python 3 version)",
long_description=open("README_ORIGINAL.rst").read(),
author="Thomas Heller",
author_email="[email protected]",
## maintainer="Jimmy Retzlaff",
## maintainer_email="[email protected]",
url="http://www.py2exe.org/",
license="MIT/X11",
install_requires=["cachetools", "pefile"],
platforms="Windows",
## download_url="http://sourceforge.net/project/showfiles.php?group_id=15583",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Operating System :: Microsoft :: Windows",
"Programming Language :: C",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Software Distribution",
"Topic :: Utilities",
],
distclass = Dist,
cmdclass = cmdclass,
## scripts = ["build_exe.py"],
entry_points = {
'console_scripts': ['build_exe = py2exe.build_exe:main'],
},
interpreters = interpreters,
py_modules=['zipextimporter'],
packages=['py2exe'],
)
# Local Variables:
# compile-command: "py -3.3 setup.py bdist_egg"
# End:
# c:\python33-64\lib\site-packages
# c:\python33-64\scripts