[compiler-rt] [compiler-rt][test] Use packaging.version.Version to compare glibc versions (PR #142596)
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 3 05:44:59 PDT 2025
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/142596
Instead of distutils.LooseVersion. distutils was depracated (https://peps.python.org/pep-0632/) and has been removed in Python 3.12 (https://docs.python.org/3/whatsnew/3.12.html)
> Of note, the distutils package has been removed from the standard library.
packaging's version is able to handle glibc's major.minor: https://packaging.pypa.io/en/latest/version.html#packaging.version.Version
> For these modules or types, use the standards-defined Python Packaging Authority packages specified:
> distutils.version — use the packaging package
Relates to https://github.com/llvm/llvm-project/issues/54337
>From c0f24208646093cf2a7c22a0c9c9982da5a625e6 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 3 Jun 2025 12:40:16 +0000
Subject: [PATCH] [compiler-rt][test] Use packaging.version.Version to compare
glibc versions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Instead of distutils.LooseVersion. distutils was depracated
(https://peps.python.org/pep-0632/) and has been removed in
Python 3.12 (https://docs.python.org/3/whatsnew/3.12.html)
> Of note, the distutils package has been removed from the standard library.
packaging's version is able to handle glibc's major.minor:
https://packaging.pypa.io/en/latest/version.html#packaging.version.Version
> For these modules or types, use the standards-defined Python Packaging Authority packages specified:
> distutils.version — use the packaging package
Relates to https://github.com/llvm/llvm-project/issues/54337
---
compiler-rt/test/lit.common.cfg.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 877718c703ba7..b44688bd25bf2 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -713,9 +713,9 @@ def add_glibc_versions(ver_string):
if config.android:
return
- from distutils.version import LooseVersion
+ from packaging.version import Version
- ver = LooseVersion(ver_string)
+ ver = Version(ver_string)
any_glibc = False
for required in [
"2.19",
@@ -727,7 +727,7 @@ def add_glibc_versions(ver_string):
"2.38",
"2.40",
]:
- if ver >= LooseVersion(required):
+ if ver >= Version(required):
config.available_features.add("glibc-" + required)
any_glibc = True
if any_glibc:
More information about the llvm-commits
mailing list