1
2
3
4
5
6
7 import os
8 import gettext
9 gettext.install("nvda", unicode=True)
10 from distutils.core import setup
11 import py2exe as py2exeModule
12 from glob import glob
13 import fnmatch
14 from versionInfo import *
15 from py2exe import build_exe
16 import wx
17 import imp
18
19 MAIN_MANIFEST_EXTRA = r"""
20 <file name="brailleDisplayDrivers\handyTech\HtBrailleDriverServer.dll">
21 <comClass
22 description="HtBrailleDriver Class"
23 clsid="{209445BA-92ED-4AB2-83EC-F24ACEE77EE0}"
24 threadingModel="Apartment"
25 progid="HtBrailleDriverServer.HtBrailleDriver"
26 tlbid="{33257EFB-336F-4680-B94E-F5013BA6B9B3}" />
27 </file>
28 <file name="brailleDisplayDrivers\handyTech\HtBrailleDriverServer.tlb">
29 <typelib tlbid="{33257EFB-336F-4680-B94E-F5013BA6B9B3}"
30 version="1.0"
31 helpdir="" />
32 </file>
33 <comInterfaceExternalProxyStub
34 name="IHtBrailleDriverSink"
35 iid="{EF551F82-1C7E-421F-963D-D9D03548785A}"
36 proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"
37 baseInterface="{00000000-0000-0000-C000-000000000046}"
38 tlbid="{33257EFB-336F-4680-B94E-F5013BA6B9B3}" />
39 <comInterfaceExternalProxyStub
40 name="IHtBrailleDriver"
41 iid="{43A71F9B-58EE-42D4-B58E-0F9FBA28D995}"
42 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
43 baseInterface="{00000000-0000-0000-C000-000000000046}"
44 tlbid="{33257EFB-336F-4680-B94E-F5013BA6B9B3}" />
45 """
46
48 for ext,mode,modType in imp.get_suffixes():
49 if modType==thisModType:
50 return ext
51 raise ValueError("unknown mod type %s"%thisModType)
52
53
54 origIsSystemDLL = build_exe.isSystemDLL
56 dll = os.path.basename(pathname).lower()
57 if dll in ("msvcp71.dll", "msvcp90.dll", "gdiplus.dll","mfc71.dll", "mfc90.dll"):
58
59 return 0
60 elif dll.startswith("api-ms-win-") or dll == "powrprof.dll":
61
62
63 return 1
64 return origIsSystemDLL(pathname)
65 build_exe.isSystemDLL = isSystemDLL
66
67 -class py2exe(build_exe.py2exe):
68 """Overridden py2exe command to:
69 * Add a command line option --enable-uiAccess to enable uiAccess for the main executable
70 * Add extra info to the manifest
71 * Don't copy w9xpopen, as NVDA will never run on Win9x
72 """
73
74 user_options = build_exe.py2exe.user_options + [
75 ("enable-uiAccess", "u", "enable uiAccess for the main executable"),
76 ]
77
81
84
86 if target is self.distribution.windows[0]:
87
88 isMainExec = True
89 if self.enable_uiAccess:
90 target.uac_info = (target.uac_info[0], True)
91 else:
92 isMainExec = False
93
94 mfest, rid = build_exe.py2exe.build_manifest(self, target, template)
95
96 if isMainExec:
97 mfest = mfest[:mfest.rindex("</assembly>")]
98 mfest += MAIN_MANIFEST_EXTRA + "</assembly>"
99
100 return mfest, rid
101
103 NVDALocaleFiles=[(os.path.dirname(f), (f,)) for f in glob("locale/*/LC_MESSAGES/*.mo")+glob("locale/*/*.dic")]
104 wxDir=wx.__path__[0]
105 wxLocaleFiles=[(os.path.dirname(f)[len(wxDir)+1:], (f,)) for f in glob(wxDir+"/locale/*/LC_MESSAGES/*.mo")]
106 NVDALocaleGestureMaps=[(os.path.dirname(f), (f,)) for f in glob("locale/*/gestures.ini")]
107 return NVDALocaleFiles+wxLocaleFiles+NVDALocaleGestureMaps
108
110 rulesList=[]
111 rulesList.append((dest,
112 [f for f in glob("%s/*"%source) if not any(fnmatch.fnmatch(f,exclude) for exclude in excludes) and os.path.isfile(f)]))
113 [rulesList.extend(getRecursiveDataFiles(os.path.join(dest,dirName),os.path.join(source,dirName),excludes=excludes)) for dirName in os.listdir(source) if os.path.isdir(os.path.join(source,dirName)) and not dirName.startswith('.')]
114 return rulesList
115
116 compiledModExtention = getModuleExtention(imp.PY_COMPILED)
117 sourceModExtention = getModuleExtention(imp.PY_SOURCE)
118 setup(
119 name = name,
120 version=version,
121 description=description,
122 url=url,
123 classifiers=[
124 'Development Status :: 3 - Alpha',
125 'Environment :: Win32 (MS Windows)',
126 'Topic :: Adaptive Technologies'
127 'Intended Audience :: Developers',
128 'Intended Audience :: End Users/Desktop',
129 'License :: OSI Approved :: GNU General Public License (GPL)',
130 'Natural Language :: English',
131 'Programming Language :: Python',
132 'Operating System :: Microsoft :: Windows',
133 ],
134 cmdclass={"py2exe": py2exe},
135 windows=[
136 {
137 "script":"nvda.pyw",
138 "uac_info": ("asInvoker", False),
139 "icon_resources":[(1,"images/nvda.ico")],
140 "version":"0.0.0.0",
141 "description":"NVDA application",
142 "product_version":version,
143 "copyright":copyright,
144 "company_name":publisher,
145 },
146 {
147 "script": "nvda_slave.pyw",
148 "icon_resources": [(1,"images/nvda.ico")],
149 "version": "0.0.0.0",
150 "description": "NVDA slave",
151 "product_version": version,
152 "copyright": copyright,
153 "company_name": publisher,
154 },
155 ],
156 service=[{
157 "modules": ["nvda_service"],
158 "icon_resources": [(1, "images/nvda.ico")],
159 "version": "0.0.0.0",
160 "description": "NVDA service",
161 "product_version": version,
162 "copyright": copyright,
163 "company_name": publisher,
164 "uac_info": ("requireAdministrator", False),
165 "cmdline_style": "pywin32",
166 }],
167 options = {"py2exe": {
168 "bundle_files": 3,
169 "excludes": ["comInterfaces", "Tkinter",
170 "serial.loopback_connection", "serial.rfc2217", "serial.serialcli", "serial.serialjava", "serial.serialposix", "serial.socket_connection"],
171 "packages": ["NVDAObjects","virtualBuffers","appModules","brailleDisplayDrivers","synthDrivers"],
172 }},
173 data_files=[
174 (".",glob("*.dll")+glob("*.manifest")+["builtin.dic"]),
175 ("documentation", ['../copying.txt', '../contributors.txt']),
176 ("lib", glob("lib/*.dll")),
177 ("lib64", glob("lib64/*.dll") + glob("lib64/*.exe")),
178 ("comInterfaces", glob("comInterfaces/*%s"%compiledModExtention)),
179 ("waves", glob("waves/*.wav")),
180 ("images", glob("images/*.ico")),
181 ("louis/tables",glob("louis/tables/*"))
182 ] + (
183 getLocaleDataFiles()
184 + getRecursiveDataFiles("synthDrivers", "synthDrivers",
185 excludes=("*%s" % sourceModExtention, "*%s" % compiledModExtention, "*.exp", "*.lib", "*.pdb"))
186 + getRecursiveDataFiles("brailleDisplayDrivers", "brailleDisplayDrivers", excludes=("*%s"%sourceModExtention,"*%s"%compiledModExtention))
187 + getRecursiveDataFiles('documentation', '../user_docs', excludes=('*.t2t', '*.t2tconf', '*/developerGuide.*'))
188 ),
189 )
190