Skip to content

Commit

Permalink
Replace distutils.LooseVersion with packaging.Version
Browse files Browse the repository at this point in the history
distutils was removed in python 3.12, so this is needed for conda-lock
to work beyond python 3.11.

Fixes #596
  • Loading branch information
jfrost-mo committed Feb 5, 2024
1 parent 2c2999b commit 5c97065
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conda_lock/invoke_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import tempfile
import threading

from distutils.version import LooseVersion
from typing import IO, Dict, Iterator, List, Optional, Sequence, Union

from ensureconda.api import determine_micromamba_version, ensureconda
from packaging.version import Version

from conda_lock.models.channel import Channel

Expand Down Expand Up @@ -57,7 +57,7 @@ def determine_conda_executable(
for candidate in _determine_conda_executable(conda_executable, mamba, micromamba):
if candidate is not None:
if is_micromamba(candidate):
if determine_micromamba_version(str(candidate)) < LooseVersion("0.17"):
if determine_micromamba_version(str(candidate)) < Version("0.17"):
mamba_root_prefix()
return candidate
raise RuntimeError("Could not find conda (or compatible) executable")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies = [
"ensureconda >=1.3",
"gitpython >=3.1.30",
"jinja2",
"packaging",
"pydantic >=1.10",
"pyyaml >= 5.1",
'tomli; python_version<"3.11"',
Expand Down

0 comments on commit 5c97065

Please sign in to comment.