Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ be112ed44cb68f622a770c72fd29dd10899e9d07
73a3529d8b10eb73a45117eead906c0a9cb4c41b
# String concatenation
9616ef6b18b5c5a5b64037a640d205868e66b964
# Run runlint.bat on scons and .pyw files
0643d6e41089fb6aed22d489c7ccc3f32381f199
# Run add-trailing-comma and ruff format on scons files
9fd7ba5cb268b64aacf45a43b1edb64c120ce20c
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ repos:
pass_filenames: false
types: [python]
files: ^source/.*$
exclude: "(sconscript|sconstruct)$"
- id: unitTest
name: unit tests
entry: ./rununittests.bat
Expand All @@ -168,3 +169,4 @@ repos:
entry: uv run pyright
language: system
types: [python]
exclude: "(sconscript|sconstruct)$"
3 changes: 2 additions & 1 deletion appx/sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2018-2025 NV Access Limited
# This file may be used under the terms of the GNU General Public License, version 2 or later, as modified by the NVDA license.
Expand All @@ -13,7 +14,7 @@ Import(
"env",
"outFilePrefix",
"isStoreSubmission",
]
],
)


Expand Down
1 change: 1 addition & 0 deletions cldrDict_sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2018-2022 NV Access Limited
# This file may be used under the terms of the GNU General Public License, version 2 or later.
Expand Down
5 changes: 4 additions & 1 deletion nvdaHelper/ISimpleDOM_sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
###
# This file is a part of the NVDA project.
# URL: http://www.nvda-project.org/
Expand All @@ -19,7 +20,9 @@ env["MIDLCOM"] = env["MIDLCOM"][:-6]
# Copy some secondary IDL files included by ISimpleDOMNode.idl
idlDeps = [
env.Command(
"ISimpleDOMText.idl", "#/miscDeps/include/ISimpleDOM/ISimpleDOMText.idl", Copy("$TARGET", "$SOURCE")
"ISimpleDOMText.idl",
"#/miscDeps/include/ISimpleDOM/ISimpleDOMText.idl",
Copy("$TARGET", "$SOURCE"),
),
env.Command(
"ISimpleDOMDocument.idl",
Expand Down
3 changes: 2 additions & 1 deletion nvdaHelper/UIARemote/sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
###
# This file is a part of the NVDA project.
# URL: http://www.nvda-project.org/
Expand All @@ -16,7 +17,7 @@ Import(
[
"env",
"localLib",
]
],
)

UIARemoteLib = env.SharedLibrary(
Expand Down
5 changes: 4 additions & 1 deletion nvdaHelper/acrobatAccess_sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
###
# This file is a part of the NVDA project.
# URL: http://www.nvda-project.org/
Expand All @@ -15,7 +16,9 @@
Import("env")

idlFile = env.Command(
"acrobatAccess.idl", "#/miscDeps/include/acrobatAccess/acrobatAccess.idl", Copy("$TARGET", "$SOURCE")
"acrobatAccess.idl",
"#/miscDeps/include/acrobatAccess/acrobatAccess.idl",
Copy("$TARGET", "$SOURCE"),
)

tlbFile, headerFile, iidSourceFile, proxySourceFile, dlldataSourceFile = env.TypeLibrary(source=idlFile)
Expand Down
23 changes: 11 additions & 12 deletions nvdaHelper/archBuild_sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2026 NV Access Limited
# This file may be used under the terms of the GNU General Public License, version 2 or later.
Expand Down Expand Up @@ -82,9 +83,7 @@ isNVDACoreArch = (
or (PYTHON_PLATFORM == "win-arm64" and TARGET_ARCH == "arm64")
)
isNVDAHelperLocalArch = isNVDACoreArch or (
PYTHON_PLATFORM == "win-amd64"
and TARGET_ARCH == "arm64"
and isArm64EC
PYTHON_PLATFORM == "win-amd64" and TARGET_ARCH == "arm64" and isArm64EC
)
debug = env["nvdaHelperDebugFlags"]
release = env["release"]
Expand All @@ -100,7 +99,7 @@ env.Append(
# NOMINMAX: prevent minwindef.h min/max macro definition, which unexpectedly override developer
# expectations
"NOMINMAX",
]
],
)

env.Append(CXXFLAGS=["/EHsc"])
Expand All @@ -116,13 +115,13 @@ env.Append(
"/WX",
subsystem,
"/release", # We always want a checksum in the header
]
],
)
env.Append(
ARFLAGS=[
"/WX",
subsystem,
]
],
)
if TARGET_ARCH == "x86_64":
env.Append(MIDLFLAGS="/x64")
Expand All @@ -149,7 +148,7 @@ if "RTC" in debug:
# We always want debug symbols
env.Append(PDB="${TARGET}.pdb")
env.Append(
LINKFLAGS="/OPT:REF"
LINKFLAGS="/OPT:REF",
) # having symbols usually turns this off but we have no need for unused symbols

env.Append(
Expand All @@ -160,7 +159,7 @@ env.Append(
# It will output a list of the include files.
# The option also displays nested include files, that is, the files
# included by the files that you include.
]
],
)

if isArm64EC:
Expand All @@ -181,7 +180,7 @@ thirdPartyEnv = env.Clone()
env.Append(
CCFLAGS=[
"/W3", # warning level 3
]
],
)
if "analyze" in debug:
env.Append(CCFLAGS=["/analyze"])
Expand All @@ -195,7 +194,7 @@ else:
env.Append(
CCFLAGS=[
"/WX", # warnings as error, don't do this with analyze, the build stops too early
]
],
)

Export("thirdPartyEnv")
Expand Down Expand Up @@ -266,7 +265,7 @@ if not isNVDAHelperLocalArch:
if isNVDACoreArch:
sonicLib = thirdPartyEnv.SConscript("sonic/sconscript")
Export("sonicLib")
env.Install(sourceDir.Dir('synthDrivers'), sonicLib)
env.Install(sourceDir.Dir("synthDrivers"), sonicLib)
thirdPartyEnv.SConscript("espeak/sconscript")
thirdPartyEnv.SConscript("liblouis/sconscript")
thirdPartyEnv.SConscript("javaAccessBridge/sconscript")
Expand All @@ -275,4 +274,4 @@ if isNVDACoreArch:
if TARGET_ARCH == "x86":
sonicLib = thirdPartyEnv.SConscript("sonic/sconscript")
Export("sonicLib")
env.Install(sourceDir.Dir('_synthDrivers32'), sonicLib)
env.Install(sourceDir.Dir("_synthDrivers32"), sonicLib)
3 changes: 2 additions & 1 deletion nvdaHelper/client/sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
###
# This file is a part of the NVDA project.
# URL: http://www.nvda-project.org/
Expand All @@ -15,7 +16,7 @@
Import(
[
"env",
]
],
)

winIPCUtilsObj = env.Object("./winIPCUtils", "../common/winIPCUtils.cpp")
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/detours/sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
Import(["thirdPartyEnv"])

import typing # noqa: E402
Expand Down
27 changes: 16 additions & 11 deletions nvdaHelper/espeak/sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
Expand All @@ -21,21 +22,21 @@ Import(
"thirdPartyEnv",
"sourceDir",
"sonicLib",
]
],
)

freeLibrary = ctypes.windll.kernel32.FreeLibrary
freeLibrary.argtypes = (ctypes.wintypes.HANDLE,)
DLL_DIRECTORY_COOKIE = ctypes.c_void_p
AddDllDirectory = ctypes.windll.kernel32.AddDllDirectory
AddDllDirectory.argtypes = (ctypes.wintypes.LPCWSTR,)
AddDllDirectory.restype = DLL_DIRECTORY_COOKIE
AddDllDirectory.restype = DLL_DIRECTORY_COOKIE

# Add the directory of the sonic dll to our DLL search path
# So that eSpeak.dll cna find it when being loaded to compile dictionaries etc.
sonicDllDir = sonicLib[0].get_dir().abspath
AddDllDirectory(sonicDllDir)


class AutoFreeCDLL(ctypes.CDLL):
def __del__(self):
Expand Down Expand Up @@ -127,7 +128,7 @@ env.Append(
"/DUSE_SPEECHPLAYER=1",
"/DUSE_KLATT=1",
"/DUSE_LIBSONIC=1",
]
],
)

env.Append(
Expand All @@ -138,7 +139,7 @@ env.Append(
espeakSrcDir.Dir("speechPlayer/include"),
sonicSrcDir,
espeakSrcDir.Dir("ucd-tools/src/include"),
]
],
)


Expand All @@ -148,7 +149,7 @@ def espeak_compilePhonemeData_buildEmitter(target, source, env):
[
[Dir(topDir).File(f) for f in files if f not in phSourceIgnores]
for topDir, subdirs, files in os.walk(source[0].abspath)
]
],
)
sources = env.Flatten([phSources])
targets = [
Expand Down Expand Up @@ -1046,13 +1047,14 @@ def espeak_compileDict_buildAction(
f"Failed to compile dictionary: '{target}'"
f"\n rulesPath: {rulesPathEncoded}"
f"\n language: '{lang}'"
f"\n result: {espeak_ng_STATUS(compileDictResult)!s}"
f"\n result: {espeak_ng_STATUS(compileDictResult)!s}",
)
return ACTION_FAILURE
finally:
espeak.espeak_Terminate()
return ACTION_SUCCESS


espeakLib = env.SharedLibrary(
target="espeak",
srcdir=espeakSrcDir.Dir("libespeak-ng").abspath,
Expand Down Expand Up @@ -1112,7 +1114,7 @@ espeakLib = env.SharedLibrary(
# com\ttsengine.cpp
# We do not use the ASYNC compile option in espeak.
],
LIBS=["advapi32", sonicLib[2]] ,
LIBS=["advapi32", sonicLib[2]],
LIBPATH=".",
)

Expand All @@ -1131,7 +1133,8 @@ for i in phonemeData:
env.AddPreAction(espeakLib, env.Action(cleanFiles_preBuildAction))
# Move any extra dictionaries into dictsource for compilation
env.Install(
espeakRepo.Dir("dictsource"), env.Glob(os.path.join(espeakRepo.abspath, "dictsource", "extra", "*_*"))
espeakRepo.Dir("dictsource"),
env.Glob(os.path.join(espeakRepo.abspath, "dictsource", "extra", "*_*")),
)

excludeLangs: typing.List[str] = []
Expand Down Expand Up @@ -1160,7 +1163,8 @@ for dictFileName, (langCode, inputFiles) in espeakDictionaryCompileList.items():
# Dictionaries can not be compiled in parallel, force SCons not to do this
env.SideEffect("_espeak_compileDict", dictFile)
env.InstallAs( # Install files to the "synthDrivers/espeak-ng-data/" dir.
os.path.join(synthDriversDir.Dir("espeak-ng-data").abspath, dictFileName), dictFile
os.path.join(synthDriversDir.Dir("espeak-ng-data").abspath, dictFileName),
dictFile,
)

env.Install(synthDriversDir, espeakLib)
Expand All @@ -1172,5 +1176,6 @@ espeakDataSource = espeakRepo.Dir("espeak-ng-data")
# also install the lang and voices/!v directories. Exclude the voices/mb directory since we are not using mbrola.
env.RecursiveInstall(targetEspeakDataDir.Dir("lang"), espeakDataSource.Dir("lang").abspath)
env.RecursiveInstall(
targetEspeakDataDir.Dir("voices").Dir("!v"), espeakDataSource.Dir("voices").Dir("!v").abspath
targetEspeakDataDir.Dir("voices").Dir("!v"),
espeakDataSource.Dir("voices").Dir("!v").abspath,
)
1 change: 1 addition & 0 deletions nvdaHelper/ia2_sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
###
# This file is a part of the NVDA project.
# URL: http://www.nvda-project.org/
Expand Down
8 changes: 5 additions & 3 deletions nvdaHelper/javaAccessBridge/sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2019-2025 NV Access Limited, Leonard de Ruijter
# This file may be used under the terms of the GNU General Public License, version 2 or later, as modified by the NVDA license.
Expand All @@ -7,7 +8,7 @@ Import(
[
"thirdPartyEnv",
"sourceDir",
]
],
)

env: Environment = thirdPartyEnv
Expand All @@ -23,6 +24,7 @@ match TARGET_ARCH:
jabDllName = None
if jabDllName:
env.Command(
sourceDir.File("windowsaccessbridge.dll"), env.Dir("#include/javaAccessBridge32").File(jabDllName), Copy("$TARGET", "$SOURCE")
sourceDir.File("windowsaccessbridge.dll"),
env.Dir("#include/javaAccessBridge32").File(jabDllName),
Copy("$TARGET", "$SOURCE"),
)

13 changes: 8 additions & 5 deletions nvdaHelper/liblouis/sconscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2011-2025 NV Access Limited, Joseph Lee, Babbage B.V., Leonard de Ruijter
# This file may be used under the terms of the GNU General Public License, version 2 or later, as modified by the NVDA license.
Expand All @@ -15,7 +16,7 @@ Import(
[
"thirdPartyEnv",
"sourceDir",
]
],
)
sourceDir: Base = sourceDir
thirdPartyEnv: Environment = thirdPartyEnv
Expand All @@ -29,7 +30,7 @@ unitTestTablesDir = env.Dir("#tests/unit/brailleTables")
signExec = env["signExec"] if (bool(env["certFile"]) ^ bool(env["apiSigningToken"])) else None

RE_AC_INIT = re.compile(
r"^AC_INIT\(\[(?P<package>.*)\], \[(?P<version>.*)\], \[(?P<bugReport>.*)\], \[(?P<tarName>.*)\], \[(?P<url>.*)\]\)"
r"^AC_INIT\(\[(?P<package>.*)\], \[(?P<version>.*)\], \[(?P<bugReport>.*)\], \[(?P<tarName>.*)\], \[(?P<url>.*)\]\)",
)


Expand All @@ -48,7 +49,7 @@ clangDirs = glob.glob(os.path.join(find_vc_pdir(env.get("MSVC_VERSION"), env), r
if len(clangDirs) == 0:
raise RuntimeError(
"Could not find the Clang compiler. "
"Perhaps the C++ Clang tools for Windows component in visual Studio is not installed"
"Perhaps the C++ Clang tools for Windows component in visual Studio is not installed",
)
env["CC"] = "clang-cl"
env["M4"] = f'"{env.File("#miscdeps/tools/m4.exe")}"'
Expand All @@ -72,15 +73,17 @@ env.Append(
"WIDECHARS_ARE_UCS4",
# Tell liblouis.h that we're exporting liblouis dll functions, not importing them.
"_EXPORTING",
]
],
)
env.Prepend(CPPPATH=[".", louisSourceDir])

# Upstream liblouis compiles without UNICODE defined.
env["CPPDEFINES"].remove("UNICODE")

liblouisH = env.Substfile(
"liblouis.h", louisSourceDir.File("liblouis.h.in"), SUBST_DICT={"@WIDECHAR_TYPE@": "unsigned int"}
"liblouis.h",
louisSourceDir.File("liblouis.h.in"),
SUBST_DICT={"@WIDECHAR_TYPE@": "unsigned int"},
)

sourceFiles = [
Expand Down
Loading
Loading