diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-09-02 11:49:37 -0700 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-09-19 20:57:52 -0400 |
commit | 188c552dcfe4aad30041263685eb421240a72e6f (patch) | |
tree | 17dd732b57d452cde8ea95119818c84fb9a9bd26 /mesonbuild/compilers | |
parent | b11cf2f37165ddf0ebe737e85768483ff4387481 (diff) | |
download | meson-188c552dcfe4aad30041263685eb421240a72e6f.zip meson-188c552dcfe4aad30041263685eb421240a72e6f.tar.gz meson-188c552dcfe4aad30041263685eb421240a72e6f.tar.bz2 |
pylint: enable use-maxsplit-arg
This finds a bunch of places where we can do more efficient string
splitting.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/detect.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/rust.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 4414a57..5c63d2d 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -473,7 +473,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin break else: raise EnvironmentException(f'Failed to detect MSVC compiler version: stderr was\n{err!r}') - cl_signature = lookat.split('\n')[0] + cl_signature = lookat.split('\n', maxsplit=1)[0] match = re.search(r'.*(x86|x64|ARM|ARM64)([^_A-Za-z0-9]|$)', cl_signature) if match: target = match.group(1) @@ -593,7 +593,7 @@ def detect_cuda_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp # - CUDA Toolkit 8.0.61 requires NVIDIA Driver 375.26 # Luckily, the "V" also makes it very simple to extract # the full version: - version = out.strip().split('V')[-1] + version = out.strip().rsplit('V', maxsplit=1)[-1] cpp_compiler = detect_cpp_compiler(env, for_machine) cls = CudaCompiler env.coredata.add_lang_args(cls.language, cls, for_machine, env) diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 296c539..a7bab0f 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -111,7 +111,7 @@ class RustCompiler(Compiler): def get_sysroot(self) -> str: cmd = self.exelist + ['--print', 'sysroot'] p, stdo, stde = Popen_safe(cmd) - return stdo.split('\n')[0] + return stdo.split('\n', maxsplit=1)[0] def get_debug_args(self, is_debug: bool) -> T.List[str]: return clike_debug_args[is_debug] |