11# -*- coding: UTF-8 -*-
2- #setup.py
3- #A part of NonVisual Desktop Access (NVDA)
4- #Copyright (C) 2006-2018 NV Access Limited, Peter Vágner, Joseph Lee
5- #This file is covered by the GNU General Public License.
6- #See the file COPYING for more details.
2+ # A part of NonVisual Desktop Access (NVDA)
3+ # Copyright (C) 2006-2022 NV Access Limited, Peter Vágner, Joseph Lee
4+ # This file is covered by the GNU General Public License.
5+ # See the file COPYING for more details.
76
87import os
98import sys
109import copy
1110import gettext
1211gettext .install ("nvda" )
1312from setuptools import setup
14- import py2exe as py2exeModule
13+ # While the import of py2exe appears unused it is required.
14+ # py2exe monkey patches distutils when importing py2exe for the first time.
15+ import py2exe as py2exeModule # noqa: F401, E402
1516from glob import glob
1617import fnmatch
1718# versionInfo names must be imported after Gettext
1819# Suppress E402 (module level import not at top of file)
1920from versionInfo import (
21+ copyright as NVDAcopyright , # copyright is a reserved python keyword
22+ description ,
2023 formatBuildVersionString ,
2124 name ,
25+ publisher ,
26+ url ,
2227 version ,
23- publisher
2428) # noqa: E402
25- from versionInfo import *
2629from py2exe import distutils_buildexe
2730from py2exe .dllfinder import DllFinder
2831import wx
2932import importlib .machinery
3033# Explicitly put the nvda_dmp dir on the build path so the DMP library is included
3134sys .path .append (os .path .join (".." , "include" , "nvda_dmp" ))
3235RT_MANIFEST = 24
33- manifest_template = """\
34- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
35- <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
36- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
37- <security>
38- <requestedPrivileges>
39- <requestedExecutionLevel
40- level="asInvoker"
41- uiAccess="%(uiAccess)s"
42- />
43- </requestedPrivileges>
44- </security>
45- </trustInfo>
46- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
47- <application>
48- <!-- Windows 7 -->
49- <supportedOS
50- Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"
51- />
52- <!-- Windows 8 -->
53- <supportedOS
54- Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"
55- />
56- <!-- Windows 8.1 -->
57- <supportedOS
58- Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"
59- />
60- <!-- Windows 10 -->
61- <supportedOS
62- Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"
63- />
64- </application>
65- </compatibility>
66- </assembly>
67- """
36+ manifestTemplateFilePath = "manifest.template.xml"
6837
6938# py2exe's idea of whether a dll is a system dll appears to be wrong sometimes, so monkey patch it.
7039orig_determine_dll_type = DllFinder .determine_dll_type
@@ -92,6 +61,8 @@ def initialize_options(self):
9261 self .enable_uiAccess = False
9362
9463 def run (self ):
64+ with open (manifestTemplateFilePath , "r" , encoding = "utf-8" ) as manifestTemplateFile :
65+ manifestTemplate = manifestTemplateFile .read ()
9566 dist = self .distribution
9667 if self .enable_uiAccess :
9768 # Add a target for nvda_uiAccess, using nvda_noUIAccess as a base.
@@ -108,7 +79,7 @@ def run(self):
10879 (
10980 RT_MANIFEST ,
11081 1 ,
111- (manifest_template % dict (uiAccess = target ['uiAccess' ])).encode ("utf-8" )
82+ (manifestTemplate % dict (uiAccess = target ['uiAccess' ])).encode ("utf-8" )
11283 ),
11384 ]
11485 super (py2exe , self ).run ()
@@ -167,7 +138,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
167138 "description" :"NVDA application" ,
168139 "product_name" :name ,
169140 "product_version" :version ,
170- "copyright" :copyright ,
141+ "copyright" : NVDAcopyright ,
171142 "company_name" :publisher ,
172143 },
173144 # The nvda_uiAccess target will be added at runtime if required.
@@ -180,7 +151,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
180151 "description" : name ,
181152 "product_name" :name ,
182153 "product_version" : version ,
183- "copyright" : copyright ,
154+ "copyright" : NVDAcopyright ,
184155 "company_name" : publisher ,
185156 },
186157 {
@@ -193,7 +164,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
193164 "description" : "NVDA Ease of Access proxy" ,
194165 "product_name" :name ,
195166 "product_version" : version ,
196- "copyright" : copyright ,
167+ "copyright" : NVDAcopyright ,
197168 "company_name" : publisher ,
198169 },
199170 ],
@@ -207,7 +178,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
207178 "description" : "NVDA Diff-match-patch proxy" ,
208179 "product_name" : name ,
209180 "product_version" : version ,
210- "copyright" : f"{ copyright } , Bill Dengler" ,
181+ "copyright" : f"{ NVDAcopyright } , Bill Dengler" ,
211182 "company_name" : f"Bill Dengler, { publisher } " ,
212183 },
213184 ],
0 commit comments