forked from nvaccess/nvda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sconstruct
executable file
·540 lines (476 loc) · 21.7 KB
/
sconstruct
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2010-2023 NV Access Limited, James Teh, Michael Curran, Peter Vágner, Joseph Lee,
# Reef Turner, Babbage B.V., Leonard de Ruijter, Łukasz Golonka, Accessolutions, Julien Cochuyt,
# Cyrille Bougot
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
import sys
import os
import platform
import multiprocessing
# Ensure we are inside the Python virtual environment.
nvdaVenv = os.getenv("NVDA_VENV")
virtualEnv = os.getenv("VIRTUAL_ENV")
if not virtualEnv or not os.path.isdir(virtualEnv):
print(
"Error: SCons cannot detect the NVDA build system Python virtual environment.\n"
"SCons must be executed using scons.bat in the root of this repository."
)
sys.exit(1)
if nvdaVenv != virtualEnv:
print("Warning: SCons launched within a custom Python virtual environment.")
# Variables for storing required version of Python, and the version which is used to run this script.
requiredPythonMajor ="3"
requiredPythonMinor = "7"
requiredPythonArchitecture = "32bit"
installedPythonMajor = str(sys.version_info.major)
installedPythonMinor = str(sys.version_info.minor)
installedPythonArchitecture = platform.architecture()[0]
# Ensure that we are running with required version of Python, otherwise inform the user and exit.
if (
installedPythonArchitecture != requiredPythonArchitecture
or installedPythonMajor != requiredPythonMajor
or installedPythonMinor != requiredPythonMinor
):
unsupportedPythonMsg = (
("This script is started with Python %s.%s %s, however to build NVDA you have to use Python %s.%s %s.\n"
"Please install the needed version of Python and launch SCons again, or if you have multiple "
"versions of Python installed start this script with required version explicitly.")
)
raise RuntimeError(unsupportedPythonMsg %(
installedPythonMajor,
installedPythonMinor,
installedPythonArchitecture,
requiredPythonMajor,
requiredPythonMinor,
requiredPythonArchitecture
)
)
sourceEnvPath = os.path.abspath(os.path.join(Dir('.').srcnode().path, "source"))
sys.path.append(sourceEnvPath)
import sourceEnv
sys.path.remove(sourceEnvPath)
import time
from glob import glob
import importlib.util
import winreg
def recursiveCopy(env,targetDir,sourceDir):
targets=[]
for topDir,subDirs,files in os.walk(sourceDir.abspath):
relTopDir=os.path.relpath(topDir,sourceDir.abspath)
for f in files:
fNode=targetDir.Dir(relTopDir).File(f)
env.Command(fNode,Dir(topDir).File(f),Copy('$TARGET','$SOURCE'))
targets.append(fNode)
if len(files)==0:
dNode=targetDir.Dir(relTopDir)
env.Command(dNode,Dir(topDir),Mkdir('$TARGET'))
targets.append(dNode)
return targets
# Import NVDA's versionInfo module.
import gettext
gettext.install("nvda")
sys.path.append("source")
import versionInfo
del sys.path[-1]
makensis = os.path.abspath(os.path.join("include", "nsis", "NSIS", "makensis.exe"))
# Get the path to xgettext.
XGETTEXT = os.path.abspath(os.path.join("miscDeps", "tools", "xgettext.exe"))
def keyCommandsDocTool(env):
import keyCommandsDoc
kcdAction=env.Action(
lambda target,source,env: not keyCommandsDoc.KeyCommandsMaker(source[0].path,target[0].path).make(),
lambda target,source,env: 'Generating %s'%target[0],
)
kcdBuilder=env.Builder(
action=kcdAction,
suffix='.t2t',
src_suffix='.t2t',
)
env['BUILDERS']['keyCommandsDoc']=kcdBuilder
keyCommandsLangBlacklist=set([])
vars = Variables()
vars.Add("version", "The version of this build", versionInfo.version)
vars.Add("version_build", "A unique number for this build.", "0")
vars.Add(BoolVariable("release", "Whether this is a release version", False))
vars.Add("publisher", "The publisher of this build", versionInfo.publisher)
vars.Add("updateVersionType", "The version type for which to check for updates", versionInfo.updateVersionType or "")
vars.Add(PathVariable("certFile", "The certificate file with which to sign executables", "",
lambda key, val, env: not val or PathVariable.PathIsFile(key, val, env)))
vars.Add("certPassword", "The password for the private key in the signing certificate", "")
vars.Add("certTimestampServer", "The URL of the timestamping server to use to timestamp authenticode signatures", "")
vars.Add(PathVariable("outputDir", "The directory where the final built archives and such will be placed", "output",PathVariable.PathIsDirCreate))
vars.Add(ListVariable("nvdaHelperDebugFlags", "a list of debugging features you require", 'none', ["debugCRT","RTC","analyze"]))
vars.Add(EnumVariable('nvdaHelperLogLevel','The level of logging you wish to see, lower is more verbose','15',allowed_values=[str(x) for x in range(60)]))
#Base environment for this and sub sconscripts
env = Environment(variables=vars,HOST_ARCH='x86',tools=[
"textfile",
"gettextTool",
"t2t"
,keyCommandsDocTool,
"doxygen",
"recursiveInstall"
])
# speed up subsequent runs by checking timestamps of targets and dependencies, and only using md5 if timestamps differ.
env.Decider('MD5-timestamp')
# Warn to run the build on multiple threads so it runs faster
numJobs = env.GetOption('num_jobs')
numCores = multiprocessing.cpu_count()
if numJobs < numCores:
print(
f"Warning: Building with {numJobs} concurrent job{'s' if numJobs != 1 else ''} "
f"while {numCores} CPU threads are available. "
f"Running SCONS with the parameter '-j{numCores}' may lead to a faster build."
)
else:
print(f"Building with {numJobs} concurrent jobs")
#Make our recursiveCopy function available to any script using this environment
env.AddMethod(recursiveCopy)
#Check for any unknown variables
unknown=vars.UnknownVariables().keys()
if len(unknown)>0:
print("Unknown commandline variables: %s"%unknown)
Exit(1)
#Ensure that any Python subprocesses (such as for py2exe) can find our Python directory in miscDeps
env['ENV']['PYTHONPATH']=";".join(sourceEnv.PYTHON_DIRS)
env["copyright"]=versionInfo.copyright
env['version_year']=versionInfo.version_year
env['version_major']=versionInfo.version_major
env['version_minor']=versionInfo.version_minor
version = env["version"]
version_build = env["version_build"]
release = env["release"]
publisher = env["publisher"]
certFile = env["certFile"]
certPassword = env["certPassword"]
certTimestampServer = env["certTimestampServer"]
userDocsDir=Dir('user_docs')
sourceDir = env.Dir("source")
Export('sourceDir')
clientDir=Dir('extras/controllerClient')
Export('clientDir')
sourceLibDir=sourceDir.Dir('lib')
Export('sourceLibDir')
sourceTypelibDir=sourceDir.Dir('typelibs')
Export('sourceTypelibDir')
sourceLibDir64=sourceDir.Dir('lib64')
Export('sourceLibDir64')
sourceLibDirArm64=sourceDir.Dir('libArm64')
Export('sourceLibDirArm64')
buildDir = Dir("build")
outFilePrefix = "nvda{type}_{version}".format(type="" if release else "_snapshot", version=version)
Export('outFilePrefix')
outputDir=Dir(env['outputDir'])
Export('outputDir')
# An action to sign an executable with certFile.
# we encrypt with SHA256 as this is the minimum required by the Windows Store for appx packages
signExecCmd = ["signtool", "sign", "/fd", "SHA256", "/f", certFile]
if certPassword:
signExecCmd.extend(("/p", certPassword))
if certTimestampServer:
signExecCmd.extend(("/tr", certTimestampServer, "/td", "SHA256"))
def signExec(target,source,env):
print([str(x) for x in target])
#sys.exit(1)
# #3795: signtool can quite commonly fail with timestamping, so allow it to try up to 3 times with a 1 second delay between each try.
res=0
for count in range(3):
res=env.Execute([signExecCmd+[target[0].abspath]])
if not res:
return 0 # success
time.sleep(1)
return res # failed
#Export via scons environment so other libraries can be signed
env['signExec']=signExec
#architecture-specific environments
archTools=['default','midl','msrpc']
env32=env.Clone(TARGET_ARCH='x86',tools=archTools)
env64=env.Clone(TARGET_ARCH='x86_64',tools=archTools)
envArm64=env.Clone(TARGET_ARCH='arm64',tools=archTools)
# Hack around odd bug where some tool [after] msvc states that static and shared objects are different
env32['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
env64['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
envArm64['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
env=env32
projectRCSubstDict={
'%version_year%':env['version_year'],
'%version_major%':env['version_major'],
'%version_minor%':env['version_minor'],
'%version_build%':env['version_build'],
'%copyright%':env['copyright'],
'%publisher%':env['publisher'],
'%version%':env['version'],
'%productName%':"%s (%s)"%(versionInfo.name,versionInfo.longName),
}
resFile=env.RES(target='build/nvda.res',
source=env.Substfile(target='build/nvda.rc', source='nvdaHelper/nvda.rc.subst', SUBST_DICT=projectRCSubstDict))
env32['projectResFile'] = resFile
env64['projectResFile'] = resFile
envArm64['projectResFile'] = resFile
#Fill sourceDir with anything provided for it by miscDeps
env.recursiveCopy(sourceDir,Dir('miscdeps/source'))
# Copy in some other dependencies.
jabDll = "windowsaccessbridge-32.dll"
Command(sourceLibDir.File(jabDll),
env.Dir("#include/javaAccessBridge32").File(jabDll),
Copy("$TARGET", "$SOURCE"))
env.SConscript('source/comInterfaces_sconscript',exports=['env'])
#Process nvdaHelper scons files
env32.SConscript('nvdaHelper/archBuild_sconscript',exports={'env':env32,'clientInstallDir':clientDir.Dir('x86'),'libInstallDir':sourceLibDir},variant_dir='build/x86')
env64.SConscript('nvdaHelper/archBuild_sconscript',exports={'env':env64,'clientInstallDir':clientDir.Dir('x64'),'libInstallDir':sourceLibDir64},variant_dir='build/x86_64')
envArm64.SConscript('nvdaHelper/archBuild_sconscript',exports={'env':envArm64,'clientInstallDir':clientDir.Dir('arm64'),'libInstallDir':sourceLibDirArm64},variant_dir='build/arm64')
#Allow all NVDA's gettext po files to be compiled in source/locale
for po in env.Glob(sourceDir.path+'/locale/*/lc_messages/*.po'):
env.gettextMoFile(po)
#Allow all key command t2t files to be generated from their userGuide t2t sources
for lang in os.listdir(userDocsDir.path):
if lang in keyCommandsLangBlacklist: continue
for ug in glob(os.path.join(userDocsDir.path,lang,'userGuide.t2t')):
env.keyCommandsDoc(File(ug).File('keyCommands.t2t'),ug)
t2tBuildConf = env.Textfile(userDocsDir.File("build.t2tConf"), [
# We need to do this one as PostProc so it gets converted for the title.
r"%!PostProc: NVDA_VERSION {}".format(version),
r"%!PreProc: NVDA_URL {}".format(versionInfo.url),
r"%!PreProc: NVDA_COPYRIGHT_YEARS {}".format(versionInfo.copyrightYears),
])
userGuideConf = os.path.join(userDocsDir.path, 'userGuide.t2tconf')
globalConf = os.path.join(userDocsDir.path, 'global.t2tconf')
changesConf = os.path.join(userDocsDir.path, 'changes.t2tconf')
styles = os.path.join(userDocsDir.path, 'styles.css')
#Allow all t2t files to be converted to html in user_docs
#As we use scons Glob this will also include the keyCommands.t2t files
for t2tFile in env.Glob(os.path.join(userDocsDir.path,'*','*.t2t')):
htmlFile=env.txt2tags(t2tFile)
#txt2tags can not be run in parallel so make sure scons knows this
env.SideEffect('_txt2tags',htmlFile)
# All of our t2t files require build.t2tConf.
styleInstallPath = os.path.dirname(t2tFile.abspath)
installedStyle = env.Install(styleInstallPath, styles)
env.Depends(
htmlFile,
[
t2tBuildConf,
userGuideConf,
globalConf,
changesConf,
styles,
installedStyle
])
# Build unicode CLDR dictionaries
env.SConscript('cldrDict_sconscript',exports=['env', 'sourceDir'])
# A builder to generate an NVDA distribution.
def NVDADistGenerator(target, source, env, for_signature):
buildVersionFn = os.path.join(str(source[0]), "_buildVersion.py")
# Make the NVDA build use the specified version.
# We don't do this using normal scons mechanisms because we want it to be cleaned up immediately after this builder
# and py2exe will cause bytecode files to be created for it which scons doesn't know about.
updateVersionType = env["updateVersionType"] or None
# Any '\n' characters written are translated to the system default line separator, os.linesep.
action = [lambda target, source, env: open(buildVersionFn, "w", encoding="utf-8").write(
'version = {version!r}\n'
'publisher = {publisher!r}\n'
'updateVersionType = {updateVersionType!r}\n'
'version_build = {version_build!r}\n'
.format(version=version, publisher=publisher, updateVersionType=updateVersionType,version_build=version_build)
)
# In Python 3 write returns the number of characters written,
# which scons treats as an error code.
and None]
buildCmd = ["cd", source[0].path, "&&",
sys.executable]
if release:
buildCmd.append("-O")
# Issue errors about str(bytes_instance), str(bytearray_instance)
buildCmd.append("-bb")
buildCmd.extend(("setup.py", "-vv", "build", "--build-base", buildDir.abspath,
"py2exe", "--dist-dir", target[0].abspath))
if release:
buildCmd.append("-O1")
if env.get("uiAccess"):
buildCmd.append("--enable-uiAccess")
action.append(buildCmd)
# #10031: Apps written in Python 3 require Universal CRT to be installed. We cannot assume users have it on their systems.
# Therefore , copy required libraries from Windows 10 SDK.
try:
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0', 0,winreg.KEY_READ|winreg.KEY_WOW64_32KEY) as SDKKey:
sdk_installationFolder = winreg.QueryValueEx(SDKKey, 'InstallationFolder')[0]
sdk_productVersion = winreg.QueryValueEx(SDKKey, 'ProductVersion')[0]
except WindowsError:
raise RuntimeError("Windows 10 SDK not found")
# The Universal CRT should be in an SDK version-specific directory
# But usually has a '.0' appended after the productVersion found in the registry.
# E.g. 10.0.1941 might e actually 10.0.1941.0.
# Thus try both.
CRTDir = os.path.join(sdk_installationFolder, "Redist", sdk_productVersion+".0", "ucrt", "DLLs", "x86")
if not os.path.isdir(CRTDir):
CRTDir = os.path.join(sdk_installationFolder, "Redist", sdk_productVersion, "ucrt", "DLLs", "x86")
if not os.path.isdir(CRTDir):
raise RuntimeError(f"Could not locate CRT dlls in SDK at {CRTDir}")
with os.scandir(CRTDir) as dir:
for file in dir:
if file.name.endswith(".dll") and file.is_file():
action.append(Copy(target[0], file.path))
if certFile:
for prog in "nvda_noUIAccess.exe", "nvda_uiAccess.exe", "nvda_slave.exe", "nvda_eoaProxy.exe":
action.append(lambda target,source,env, progByVal=prog: signExec([target[0].File(progByVal)],source,env))
action.extend((
Delete(buildVersionFn),
Delete(importlib.util.cache_from_source(buildVersionFn))
))
return action
env["BUILDERS"]["NVDADist"] = Builder(generator=NVDADistGenerator, target_factory=Dir)
# A builder to generate a zip archive.
# We roll our own instead of using env.Zip because we want to create some archives
# relative to a specified directory.
def ZipArchiveAction(target, source, env):
relativeTo = env.get("relativeTo", None)
if relativeTo:
relativeTo = relativeTo.path
def getArcName(origName):
arcName = os.path.relpath(origName, relativeTo)
if arcName.startswith(".."):
arcName = arcName.replace(".." + os.path.sep, "")
return "" if arcName == "." else arcName
else:
getArcName = lambda origName: "" if origName == "." else origName
# Nasty hack to make zipfile use best compression, since it isn't configurable.
# Tried setting memlevel to 9 as well, but it made compression slightly worse.
import zlib
origZDefComp = zlib.Z_DEFAULT_COMPRESSION
zlib.Z_DEFAULT_COMPRESSION = zlib.Z_BEST_COMPRESSION
import zipfile
zf = None
try:
zf = zipfile.ZipFile(target[0].path, "w", zipfile.ZIP_DEFLATED)
for s in source:
if os.path.isdir(s.path):
for path, dirs, files in os.walk(s.path):
arcPath = getArcName(path)
if arcPath:
zf.write(path, arcPath)
for f in files:
zf.write(os.path.join(path, f), os.path.join(arcPath, f))
else:
zf.write(s.path, getArcName(s.path))
finally:
if zf:
zf.close()
zlib.Z_DEFAULT_COMPRESSION = origZDefComp
env["BUILDERS"]["ZipArchive"] = Builder(action=ZipArchiveAction)
uninstFile=File("dist/uninstall.exe")
uninstGen = env.Command(File("uninstaller/uninstGen.exe"), "uninstaller/uninst.nsi",
[[makensis, "/V2",
"/DVERSION=$version", '/DPUBLISHER="$publisher"','/DCOPYRIGHT="$copyright"','/DVERSION_YEAR="$version_year"','/DVERSION_MAJOR="$version_major"','/DVERSION_MINOR="$version_minor"','/DVERSION_BUILD="$version_build"',
"/DUNINSTEXE=%s"%uninstFile.abspath,
"/DINSTEXE=${TARGET.abspath}",
"$SOURCE"]])
uninstaller=env.Command(uninstFile,uninstGen,[uninstGen])
if certFile:
env.AddPostAction(uninstaller, [signExec])
dist = env.NVDADist("dist", [sourceDir,userDocsDir], uiAccess=bool(certFile))
env.Depends(dist,uninstaller)
# Dir node targets don't get cleaned, so cleaning of the dist nodes has to be explicitly specified.
env.Clean(dist, dist)
# Clean the intermediate build directory.
env.Clean([dist], buildDir)
launcher = env.Command(outputDir.File("%s.exe" % outFilePrefix), ["launcher/nvdaLauncher.nsi", dist],
[[makensis, "/V2",
"/DVERSION=$version", '/DPUBLISHER="$publisher"','/DCOPYRIGHT="$copyright"','/DVERSION_YEAR="$version_year"','/DVERSION_MAJOR="$version_major"','/DVERSION_MINOR="$version_minor"','/DVERSION_BUILD="$version_build"',
"/DNVDADistDir=${SOURCES[1].abspath}", "/DLAUNCHEREXE=${TARGET.abspath}",
"$SOURCE"]])
if certFile:
env.AddPostAction(launcher, [signExec])
env.Alias("launcher", launcher)
clientArchive = env.ZipArchive(outputDir.File("%s_controllerClient.zip" % outFilePrefix), clientDir, relativeTo=clientDir)
env.Alias("client", clientArchive)
outputStylesFile=env.Command(outputDir.File("styles.css"),userDocsDir.File('styles.css'),Copy('$TARGET','$SOURCE'))
changesFile=env.Command(outputDir.File("%s_changes.html" % outFilePrefix),userDocsDir.File('en/changes.html'),Copy('$TARGET','$SOURCE'))
env.Depends(changesFile, outputStylesFile)
env.Alias('changes',changesFile)
userGuideFile=env.Command(outputDir.File("userGuide.html"),userDocsDir.File('en/userGuide.html'),Copy('$TARGET','$SOURCE'))
env.Depends(userGuideFile, outputStylesFile)
env.Alias('userGuide',userGuideFile)
def makePotSourceFileList(target, sourceFiles, env):
potSourceFiles = [
os.path.relpath(str(f), str(sourceDir)) for f in sourceFiles
]
with open(target.abspath, "w") as fileList:
fileList.writelines([f + '\n' for f in potSourceFiles])
def makePot(target, source, env):
potSourceFileList = outputDir.File("potSourceFileList.txt")
makePotSourceFileList(potSourceFileList, source, env)
# Generate the pot.
if env.Execute([
[
"cd", sourceDir, "&&",
XGETTEXT,
"-o", target[0].abspath,
"--package-name", versionInfo.name, "--package-version", version,
"--foreign-user",
"--add-comments=Translators:",
"--keyword=pgettext:1c,2",
"--keyword=npgettext:1c,2,3",
"--from-code", "utf-8",
# Needed because xgettext doesn't recognise the .pyw extension.
"--language=python",
# Too many files to list on commandline, use a file list instead.
f"--files-from={potSourceFileList.abspath}",
]
]) != 0:
raise RuntimeError("xgettext failed")
# Tweak the headers.
potFn = str(target[0])
tmpFn = "%s.tmp" % potFn
with open(potFn, "rt", encoding="utf-8") as inp, open(tmpFn, "wt", encoding="utf-8") as out:
for lineNum, line in enumerate(inp):
if lineNum == 1:
line = "# %s\n" % versionInfo.copyright
elif lineNum == 2:
# Delete line.
continue
elif lineNum == 15:
line = line.replace("CHARSET", "UTF-8")
out.write(line)
os.remove(potFn)
os.rename(tmpFn, potFn)
env.SConscript("devDocs/sconscript", exports=["env", "outputDir", "sourceDir", "t2tBuildConf"])
def getSubDirs(path):
for root, dirNames, fileNames in os.walk(path):
yield root
# The Glob() SCons function doesnt have the ability to go recursive. Instead
# walk the dirs and match patterns.
potSourceFiles = [
# Don't use sourceDir as the source, as this depends on comInterfaces and nvdaHelper.
# We only depend on the Python files.
f for recurseDirs in getSubDirs(sourceDir.path)
if not (
# Exclude comInterfaces, since these don't contain translatable strings
# and they cause unknown encoding warnings.
recurseDirs.startswith(r"source\comInterfaces")
# Exclude userConfig folder which does not contain NVDA code but may contain gettext call without
# translator comments in add-ons or scratchpad, triggering false positive for checkpot script.
or recurseDirs.startswith(r"source\userConfig")
)
for pattern in ("*.py", "*.pyw")
for f in env.Glob(
os.path.join(recurseDirs, pattern),
)
]
pot = env.Command(
outputDir.File("%s.pot" % outFilePrefix),
potSourceFiles,
makePot
)
env.Alias("pot", pot)
symbolsList=[]
symbolsList.extend(env.Glob(os.path.join(sourceLibDir.path,'*.pdb')))
symbolsList.extend(env.Glob(os.path.join(sourceLibDir64.path,'*.pdb')))
symbolsArchive = env.ZipArchive(outputDir.File("%s_debugSymbols.zip" % outFilePrefix), symbolsList)
env.Alias("symbolsArchive", symbolsArchive)
appx_storeSubmission=env.SConscript("appx/sconscript",exports={'env':env,'isStoreSubmission':True},variant_dir='build\\appx_storeSubmission')
installed_appx_storeSubmission=env.Install('output',appx_storeSubmission)
appx_sideLoadable=env.SConscript("appx/sconscript",exports={'env':env,'isStoreSubmission':False},variant_dir='build\\appx_sideLoadable')
installed_appx_sideLoadable=env.Install('output',appx_sideLoadable)
env.Alias('appx',[installed_appx_storeSubmission,installed_appx_sideLoadable])
env.Default(dist)
env.SConscript("tests/sconscript", exports=["env", "sourceDir", "pot"])