Call startswith once with a tuple (#8998)

This commit is contained in:
Hugo van Kemenade 2025-06-08 19:19:53 +02:00 committed by GitHub
commit 8e5a15bab7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -163,7 +163,7 @@ def _find_library_dirs_ldconfig() -> list[str]:
args: list[str] args: list[str]
env: dict[str, str] env: dict[str, str]
expr: str expr: str
if sys.platform.startswith("linux") or sys.platform.startswith("gnu"): if sys.platform.startswith(("linux", "gnu")):
if struct.calcsize("l") == 4: if struct.calcsize("l") == 4:
machine = os.uname()[4] + "-32" machine = os.uname()[4] + "-32"
else: else:
@ -623,11 +623,7 @@ class pil_build_ext(build_ext):
for extension in self.extensions: for extension in self.extensions:
extension.extra_compile_args = ["-Wno-nullability-completeness"] extension.extra_compile_args = ["-Wno-nullability-completeness"]
elif ( elif sys.platform.startswith(("linux", "gnu", "freebsd")):
sys.platform.startswith("linux")
or sys.platform.startswith("gnu")
or sys.platform.startswith("freebsd")
):
for dirname in _find_library_dirs_ldconfig(): for dirname in _find_library_dirs_ldconfig():
_add_directory(library_dirs, dirname) _add_directory(library_dirs, dirname)
if sys.platform.startswith("linux") and os.environ.get("ANDROID_ROOT"): if sys.platform.startswith("linux") and os.environ.get("ANDROID_ROOT"):