From 2638d82af86e98d96948e965c9882d5879deaf5d Mon Sep 17 00:00:00 2001 From: awaelchli Date: Sun, 4 Aug 2024 09:28:47 +0200 Subject: [PATCH] Avoid deprecated distutils for docs build (#20156) --- .actions/assistant.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.actions/assistant.py b/.actions/assistant.py index ac0f83458e..15a20e63c6 100644 --- a/.actions/assistant.py +++ b/.actions/assistant.py @@ -18,13 +18,13 @@ import re import shutil import tempfile import urllib.request -from distutils.version import LooseVersion from itertools import chain from os.path import dirname, isfile from pathlib import Path from typing import Any, Dict, Iterable, Iterator, List, Optional, Sequence, Tuple from packaging.requirements import Requirement +from packaging.version import Version REQUIREMENT_FILES = { "pytorch": ( @@ -84,7 +84,7 @@ class _RequirementWithComment(Requirement): if unfreeze == "major": for operator, version in specs: if operator in ("<", "<="): - major = LooseVersion(version).version[0] + major = Version(version).major # replace upper bound with major version increased by one return out.replace(f"{operator}{version}", f"<{major + 1}.0") elif unfreeze == "all":