Skip to content

Commit 2ea0fde

Browse files
committed
* SCons, pick number of available cores when running with -j0
* Add scons source precommit
1 parent 2dfdd3f commit 2ea0fde

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ repos:
3434

3535
- repo: local
3636
hooks:
37+
- id: scons-source
38+
name: running build system
39+
entry: cmd.exe /c "scons source -j 0"
40+
language: system
41+
pass_filenames: false
42+
types_or: [c, c++]
3743
- id: checkPot
3844
name: translation string check
39-
entry: cmd.exe /c "scons checkPot -j 4"
45+
entry: cmd.exe /c "scons checkPot -j 0"
4046
language: system
4147
pass_filenames: false
4248
types: [python]

sconstruct

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,15 @@ env.Decider("MD5-timestamp")
162162
# Warn to run the build on multiple threads so it runs faster
163163
numJobs = env.GetOption("num_jobs")
164164
numCores = multiprocessing.cpu_count()
165+
if numJobs == 0:
166+
numJobs = numCores
167+
env.SetOption('num_jobs', numJobs)
165168
if numJobs < numCores:
166169
print(
167170
f"Warning: Building with {numJobs} concurrent job{'s' if numJobs != 1 else ''} "
168171
f"while {numCores} CPU threads are available. "
169-
f"Running SCONS with the parameter '-j{numCores}' may lead to a faster build."
172+
f"Running SCONS with the parameter '-j{numCores}' may lead to a faster build. "
173+
"Running SCONS with parameter '-j0' will automatically pick all available cores."
170174
)
171175
else:
172176
print(f"Building with {numJobs} concurrent jobs")

user_docs/en/changes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Please refer to [the developer guide](https://www.nvaccess.org/files/nvda/docume
2626

2727
* Added a `.editorconfig` file to NVDA's repository in order for several IDEs to pick up basic NVDA code style rules by default. (#16795, @LeonarddeR)
2828
* It is now possible to redirect objects retrieved from on-screen coordinates, by using the `NVDAObject.objectFromPointRedirect` method. (#16788, @Emil-18)
29+
* Running SCons with the parameter `-j0` will automatically pick the maximum number of available CPU cores. (#16868 , @LeonarddeR)
30+
* Updated Ruff to version 0.5.2. (#16868 , @LeonarddeR)
2931

3032
#### Deprecations
3133

0 commit comments

Comments
 (0)