gitlab: resolve deprecation warning in update.py

The distutils module has been marked as deprecated since python3.10 and
will be removed in python3.12 as announced in
[PEP 632](https://peps.python.org/pep-0632/).

The PEP suggests to replace `distutils.version` with
`packaging.version`.
This commit is contained in:
Yaya 2022-07-29 11:04:54 +00:00 committed by Winter
parent 875287b341
commit 0cad4b2633

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -I nixpkgs=../../../.. -i python3 -p bundix bundler nix-update nix nix-universal-prefetch python3 python3Packages.requests python3Packages.click python3Packages.click-log prefetch-yarn-deps
#! nix-shell -I nixpkgs=../../../.. -i python3 -p bundix bundler nix-update nix nix-universal-prefetch python3 python3Packages.requests python3Packages.click python3Packages.click-log python3Packages.packaging prefetch-yarn-deps
import click
import click_log
@ -10,7 +10,7 @@ import subprocess
import json
import pathlib
import tempfile
from distutils.version import LooseVersion
from packaging.version import Version
from typing import Iterable
import requests
@ -37,7 +37,7 @@ class GitLabRepo:
versions = list(filter(self.version_regex.match, tags))
# sort, but ignore v and -ee for sorting comparisons
versions.sort(key=lambda x: LooseVersion(x.replace("v", "").replace("-ee", "")), reverse=True)
versions.sort(key=lambda x: Version(x.replace("v", "").replace("-ee", "")), reverse=True)
return versions
def get_git_hash(self, rev: str):