mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -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.
|
||||
"""
|
||||
components = s.split("-")
|
||||
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
|
||||
|
||||
miniconda_n, _, remainder = s.partition("-")
|
||||
suffix = miniconda_n[-1]
|
||||
if suffix in string.digits:
|
||||
flavor = miniconda_n[:-1]
|
||||
else:
|
||||
flavor = miniconda_n
|
||||
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)
|
||||
|
||||
def to_filename(self):
|
||||
|
|
Loading…
Reference in a new issue