Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python version extraction breaks if a trailing space exists #43

Closed
ferndot opened this issue Jul 18, 2022 · 4 comments · Fixed by #59
Closed

Python version extraction breaks if a trailing space exists #43

ferndot opened this issue Jul 18, 2022 · 4 comments · Fixed by #59
Assignees

Comments

@ferndot
Copy link

ferndot commented Jul 18, 2022

Hello! It appears that Python version extraction is currently breaking if the python-versions = "x.x.x" line in poetry.lock includes a trailing space. This trailing space will be added if the Python version specification in pyproject.toml also includes a trailing space. I found this because the VSCode TOML plugin I am using adds these spaces: oovm/vscode-toml#7.

When that happens, the Heroku build fails with the following message:

-----> 3.9.11  is not valid, please specify an exact Python version (e.g. 3.8.1) in your pyproject.toml (and thus poetry.lock)

To make this more robust, I propose that we strip out spaces in this command:

PYTHON_RUNTIME_VERSION="$(sed -n -e '/^\[metadata\]/,/^\[/p' poetry.lock | sed -n -e 's/^python-versions\s*=\s*//p' | tr -d \"\')"

@ferndot
Copy link
Author

ferndot commented Jul 18, 2022

I may have a chance to contribute a patch, but wanted to put this up in case someone else gets to it first!

@zyv
Copy link
Contributor

zyv commented Jul 19, 2022

Oh, that's a good catch. I wonder if adjusting tr set would be enough:

-PYTHON_RUNTIME_VERSION="$(sed -n -e '/^\[metadata\]/,/^\[/p' poetry.lock | sed -n -e 's/^python-versions\s*=\s*//p' | tr -d \"\')" 
+PYTHON_RUNTIME_VERSION="$(sed -n -e '/^\[metadata\]/,/^\[/p' poetry.lock | sed -n -e 's/^python-versions\s*=\s*//p' | tr -d \" \')" 

A PR with a test would be appreciated.

@zyv
Copy link
Contributor

zyv commented Sep 2, 2022

Since we are at it, maybe you could have a look @felix11h ?

@felix11h
Copy link
Contributor

felix11h commented Sep 7, 2022

Since we are at it, maybe you could have a look @felix11h ?

Sure thing, I will have a look! I'm hoping to get to it next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants