8000 get_python_version_for_prefix in prefix_data.py doesn't handle two digit minor version · Issue #9917 · conda/conda · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
get_python_version_for_prefix in prefix_data.py doesn't handle two digit minor version #9917
Closed
@colesbury

Description

@colesbury

The function get_python_version_for_prefix silently truncates two digit minor version numbers. For example, if the Python version number is 3.10, it will return "3.1", which can cause some packages to be installed in the incorrect location.

Of course, there isn't a Python 3.10 yet -- I ran into this while experimenting. FWIW, the accepted PEP 602 suggests that 3.10 will be the version after 3.9 (as opposed to 4.0).

def get_python_version_for_prefix(prefix):
# returns a string e.g. "2.7", "3.4", "3.5" or None
py_record_iter = (rcrd for rcrd in PrefixData(prefix).iter_records() if rcrd.name == 'python')
record = next(py_record_iter, None)
if record is None:
return None
next_record = next(py_record_iter, None)
if next_record is not None:
raise CondaDependencyError("multiple python records found in prefix %s" % prefix)
else:
return record.version[:3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuegreat for new contributors, code change is envisioned to be trivial/relatively straight-forwardlocked[bot] locked due to inactivitysource::communitycatch-all for issues filed by community memberstype::featurerequest for a new feature or capability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0