[llvm] Replace distutils.version with looseversion since the former was deprecated in python 3.10 and removed in 3.12. (PR #99549)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 12:04:35 PDT 2024


https://github.com/dyung created https://github.com/llvm/llvm-project/pull/99549

Python deprecated the distutils package in 3.10, and removed it in 3.12 causing problems when trying to run the lit tests with 3.12.

https://docs.python.org/3.10/library/distutils.html

Replace usage with the looseversion package which should be a drop-in replacement for the original usage.

>From 56cd7073cf25c69928e9c81fcc0bc810f3b45784 Mon Sep 17 00:00:00 2001
From: Douglas Yung <douglas.yung at sony.com>
Date: Thu, 18 Jul 2024 12:00:25 -0700
Subject: [PATCH] Replace distutils.version with looseversion since the former
 was deprecated in python 3.10 and removed in 3.12.

---
 cross-project-tests/lit.cfg.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py
index 774c4eaf4d976..47062866fbc26 100644
--- a/cross-project-tests/lit.cfg.py
+++ b/cross-project-tests/lit.cfg.py
@@ -4,8 +4,7 @@
 import subprocess
 import sys
 
-# TODO: LooseVersion is undocumented; use something else.
-from distutils.version import LooseVersion
+from looseversion import LooseVersion
 
 import lit.formats
 import lit.util



More information about the llvm-commits mailing list