mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Fix miniconda version handling
Anaconda and miniconda have changed their version string format again, so the parsing needs to be done differently. `add_miniconda.py` can now parse all existing definition files properly.
This commit is contained in:
parent
2506c9773c
commit
dd5378941a
1 changed files with 11 additions and 8 deletions
|
@ -150,20 +150,23 @@ class CondaVersion(NamedTuple):
|
||||||
"""
|
"""
|
||||||
Convert a string of the form "miniconda_n-ver" or "miniconda_n-py_ver-ver" to a :class:`CondaVersion` object.
|
Convert a string of the form "miniconda_n-ver" or "miniconda_n-py_ver-ver" to a :class:`CondaVersion` object.
|
||||||
"""
|
"""
|
||||||
components = s.split("-")
|
miniconda_n, _, remainder = s.partition("-")
|
||||||
if len(components) == 3:
|
|
||||||
miniconda_n, py_ver, ver = components
|
|
||||||
py_ver = PyVersion(f"py{py_ver.replace('.', '')}")
|
|
||||||
else:
|
|
||||||
miniconda_n, ver = components
|
|
||||||
py_ver = None
|
|
||||||
|
|
||||||
suffix = miniconda_n[-1]
|
suffix = miniconda_n[-1]
|
||||||
if suffix in string.digits:
|
if suffix in string.digits:
|
||||||
flavor = miniconda_n[:-1]
|
flavor = miniconda_n[:-1]
|
||||||
else:
|
else:
|
||||||
flavor = miniconda_n
|
flavor = miniconda_n
|
||||||
suffix = ""
|
suffix = ""
|
||||||
|
|
||||||
|
components = remainder.split("-")
|
||||||
|
if flavor == Flavor.MINICONDA and len(components) >= 2:
|
||||||
|
py_ver, *ver_parts = components
|
||||||
|
py_ver = PyVersion(f"py{py_ver.replace('.', '')}")
|
||||||
|
ver = "-".join(ver_parts)
|
||||||
|
else:
|
||||||
|
ver = "-".join(components)
|
||||||
|
py_ver = None
|
||||||
|
|
||||||
return CondaVersion(Flavor(flavor), Suffix(suffix), VersionStr(ver), py_ver)
|
return CondaVersion(Flavor(flavor), Suffix(suffix), VersionStr(ver), py_ver)
|
||||||
|
|
||||||
def to_filename(self):
|
def to_filename(self):
|
||||||
|
|
Loading…
Reference in a new issue