Skip to content

Commit

Permalink
Fix edge case from refactor to pydantic (#139)
Browse files Browse the repository at this point in the history
* Fix edge case from refactor to pydantic -- only search for any python version when a specific version was not requested.

* Add news fragment.
  • Loading branch information
matteius committed May 19, 2023
1 parent 00bd7d0 commit 674f566
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/139.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix edge case from refactor to pydantic -- only search for any python version when a specific version was not requested.
4 changes: 2 additions & 2 deletions src/pythonfinder/models/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,14 @@ def alternate_sub_finder(obj):
found_version = sub_finder(path)
if found_version:
return found_version
if alternate_sub_finder:
if name and not (minor or patch or pre or dev or arch or major):
for path in paths:
found_version = alternate_sub_finder(path)
if found_version:
return found_version

ver = next(iter(self.get_pythons(sub_finder)), None)
if not ver and alternate_sub_finder is not None:
if not ver and name and not (minor or patch or pre or dev or arch or major):
ver = next(iter(self.get_pythons(alternate_sub_finder)), None)

if ver:
Expand Down

0 comments on commit 674f566

Please sign in to comment.