Correct constraint extraction code for Python not installed error message #605
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some of the templates make use of Python packages. These dependencies are managed by the "Poetry" tool.
The templates provide a task for automatically installing the project's managed version of Poetry (#604). Python is required to install Poetry (and to use it after installation), so this is a prerequisite for project contributors using the template locally. In order to make the project infrastructure more friendly for contributors, instead of failing with a cryptic error if Python is not installed, the task starts by checking whether Python is installed, and if not displays a friendly error message explaining the need to install it.
The project's standard Python version must later be available for use by Poetry, so it makes sense for the contributor to install that version of Python in this case, rather than installing an arbitrary version and then needing to install yet another copy later. For this reason, the task contains code to determine the version constraint for the Python dependency and include that information in the error message.
Previously that code extracted the version constraint for Poetry instead of for Python as intended, resulting in incorrect information in the error message. The code is hereby corrected to get the correct data.