-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
198 lines (166 loc) · 7.18 KB
/
setup.py
File metadata and controls
198 lines (166 loc) · 7.18 KB
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
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/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 = []
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,
)
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=["/NOENTRY"],
)
interpreters = [run, run_w, resource_dll,
run_ctypes_dll]
try:
from wheel import bdist_wheel
except ImportError:
my_bdist_wheel = None
else:
class my_bdist_wheel(bdist_wheel.bdist_wheel):
"""We change the bdist_wheel command so that it creates a
wheel-file compatible with Python 3.3 and Python 3.4 only by
setting the impl_tag to py33.py34.
"""
def get_tag(self):
impl_tag, abi_tag, plat_tag = super().get_tag()
return "py33.py34", abi_tag, plat_tag
if __name__ == "__main__":
import py2exe
cmdclass = {'build_interpreters': BuildInterpreters}
if my_bdist_wheel is not None:
cmdclass['bdist_wheel'] = my_bdist_wheel
setup(name="py2exe",
version=py2exe.__version__,
description="Build standalone executables for Windows (python 3 version)",
long_description=open("README.rst").read(),
author="Thomas Heller",
author_email="theller@ctypes.org",
## maintainer="Jimmy Retzlaff",
## maintainer_email="jimmy@retzlaff.com",
url="http://www.py2exe.org/",
license="MIT/X11",
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.3",
"Programming Language :: Python :: 3.4",
"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