tc-build: Updates to ruff.toml (April 16, 2026)#330
Merged
nathanchance merged 15 commits intoClangBuiltLinux:mainfrom Apr 17, 2026
Merged
tc-build: Updates to ruff.toml (April 16, 2026)#330nathanchance merged 15 commits intoClangBuiltLinux:mainfrom
nathanchance merged 15 commits intoClangBuiltLinux:mainfrom
Conversation
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
To catch any changes to ruff's default rule set. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
While this is a little more verbose, it should result in easier to read exceptions since the exception message won't be printed twice in the stacktrace. This also allows us to drop disabling TRY003. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
To clear up ruff warnings such as:
error[EXE001]: Shebang is present but file is not executable
--> tc_build/binutils.py:1:1
|
1 | #!/usr/bin/env python3
| ^^^^^^^^^^^^^^^^^^^^^^
2 |
3 | import os
|
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Fixes ruff warnings such as:
error[PLR6201]: Use a set literal when testing for membership
--> tc_build/llvm.py:494:45
|
492 | 'llvm-ranlib',
493 | ]
494 | if self.distribution_profile in ('kernel', 'rust'):
| ^^^^^^^^^^^^^^^^^^
495 | distribution_components += [
496 | 'llvm-nm',
|
help: Convert to `set
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
ruff points out that modifying a list while iterating over it is
suspect:
error[B909]: Mutation to loop iterable `pgo_targets` during iteration
--> build-llvm.py:730:13
|
728 | f"Both full and slim were specified for {config_target}, ignoring full..."
729 | )
730 | pgo_targets.remove(config_target)
| ^^^^^^^^^^^^^^^^^^
731 |
732 | if pgo_targets:
|
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
… method
error[PLR6301]: Method `default_projects` could be a function, class method, or static method
--> tc_build/llvm.py:844:9
|
842 | self._repo_url = 'https://github.com/llvm/llvm-project.git'
843 |
844 | def default_projects(self):
| ^^^^^^^^^^^^^^^^
845 | return ['clang', 'compiler-rt', 'lld', 'polly']
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
It makes sense to keep this close together with default_targets(), so
mark it as a static method for now.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
error[PLR6301]: Method `can_use_perf` could be a function, class method, or static method
--> tc_build/llvm.py:300:9
|
298 | tc_build.utils.create_gitignore(self.folders.install)
299 |
300 | def can_use_perf(self) -> bool:
| ^^^^^^^^^^^^
301 | # Make sure perf is in the environment
302 | if shutil.which('perf'):
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
This could be its own method but this avoids having to change
the imports in build-llvm.py for little reason.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
error[PLR6301]: Method `check_dependencies` could be a function, class method, or static method
--> tc_build/llvm.py:320:9
|
318 | return False
319 |
320 | def check_dependencies(self) -> None:
| ^^^^^^^^^^^^^^^^^^
321 | deps = ['cmake', 'curl', 'git', 'ninja']
322 | for dep in deps:
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
This could be its own method but this avoids having to change
the imports in build-llvm.py for little reason.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
error[PLR6301]: Method `generate_versioned_binaries` could be a function, class method, or static method
--> tc_build/tools.py:144:9
|
142 | return Path(tool)
143 |
144 | def generate_versioned_binaries(self) -> list[str]:
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
145 | try:
146 | cmakelists_txt = tc_build.utils.curl(
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
error[PLR6301]: Method `host_target` could be a function, class method, or static method
--> tc_build/llvm.py:561:9
|
559 | )
560 |
561 | def host_target(self) -> str:
| ^^^^^^^^^^^
562 | uname_to_llvm: dict[str, str] = {
563 | 'aarch64': 'AArch64',
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
This could be its own method but this avoids having to change
the imports in build-llvm.py for little reason.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
error[PLR6301]: Method `cc_is_multicall` could be a function, class method, or static method
--> tc_build/tools.py:60:9
|
58 | self.ranlib = self.find_host_ranlib()
59 |
60 | def cc_is_multicall(self, cc: Path | str) -> bool:
| ^^^^^^^^^^^^^^^
61 | return Path(cc).resolve().name == 'llvm'
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
ruff warns:
error[PLR6301]: Method `can_use_ias` could be a function, class method, or static method
--> tc_build/kernel.py:139:9
|
137 | tc_build.utils.print_info(f"Build duration: {tc_build.utils.get_duration(build_start)}")
138 |
139 | def can_use_ias(self) -> bool:
| ^^^^^^^^^^^
140 | return True
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
error[PLR6301]: Method `can_use_ias` could be a function, class method, or static method
--> tc_build/kernel.py:273:9
|
271 | super().__init__('powerpc')
272 |
273 | def can_use_ias(self) -> bool:
| ^^^^^^^^^^^
274 | return False
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
error[PLR6301]: Method `needs_binutils` could be a function, class method, or static method
--> tc_build/kernel.py:297:9
|
296 | # ClangBuiltLinux/linux#1601
297 | def needs_binutils(self) -> bool:
| ^^^^^^^^^^^^^^
298 | return True
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
error[PLR6301]: Method `can_use_ias` could be a function, class method, or static method
--> tc_build/kernel.py:375:9
|
373 | super().build()
374 |
375 | def can_use_ias(self) -> bool:
| ^^^^^^^^^^^
376 | return True
|
help: Consider adding `@typing.override` if this method overrides a method from a superclass
It would be useful to use the typing override decorator as it suggests
but that is only available with Python 3.12 and newer and I do not want
to depend on typing_extensions for it.
Rework this logic to use static class members.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
To gain access to some experimental warnings that are still useful. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
msfjarvis
approved these changes
Apr 17, 2026
| llvm_tot_ver = 23 | ||
| else: | ||
| if not (match := re.search(r'set\(LLVM_VERSION_MAJOR\s+(\d+)', cmakelists_txt)): | ||
| msg = 'Could not find LLVM_VERSION_MAJOR in CMakeLists.txt?' |
Member
There was a problem hiding this comment.
Non-blocking: This is not searching CMakeLists.txt, might be worth changing?
nathanchance
added a commit
to nathanchance/tc-build
that referenced
this pull request
Apr 17, 2026
…ate_versioned_binaries() As pointed out by Harsh in ClangBuiltLinux#330, we are no longer downloading CMakeLists.txt for LLVM's main version, as it was moved to cmake/Modules/LLVMVersion.cmake. Update the variable names and the file name reported to the user to be fully accurate. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See the individual changes for the full details.