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

fix: fix Python venv in core24 classic snaps #4946

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

tigarmo
Copy link
Contributor

@tigarmo tigarmo commented Jul 31, 2024

Changes to virtual environment handling made our default approach - creating a venv in the build system and then just moving it into the snap - not work for Python 3.12.

My understanding of the issue is that the "home" key in the "pyvenv.cfg" file points to a path in the build system, which obviously does not exist at snap-run-time. This apparently works fine somehow in core22 - likely there's some fallback logic that makes the interpreter correctly find the bundled Python libraries, but not in core24. So to address this we update this "home" key to point to its final destination in the snap.

Fixes #4942

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run tox run -m lint?
  • Have you successfully run tox run -e test-py310? (supported versions: py39, py310, py311, py312)

@tigarmo tigarmo force-pushed the work/CRAFT-3162-python-plugin-core24 branch from a2df2cd to 25aa990 Compare July 31, 2024 15:20
Changes to virtual environment handling made our default approach - creating a
venv in the build system and then just moving it into the snap - not work for
Python 3.12.

My understanding of the issue is that the "home" key in the "pyvenv.cfg" file
points to a path in the build system, which obviously does not exist at
snap-run-time. This apparently works fine *somehow* in core22 - likely there's
some fallback logic that makes the interpreter correctly find the bundled
Python libraries, but not in core24. So to address this we update this "home"
key to point to its final destination in the snap.

Fixes #4942
@tigarmo tigarmo force-pushed the work/CRAFT-3162-python-plugin-core24 branch from 25aa990 to 2daeb24 Compare July 31, 2024 15:58
@tigarmo tigarmo marked this pull request as ready for review July 31, 2024 16:47
@tigarmo tigarmo requested review from mr-cal and a team July 31, 2024 16:47
@tigarmo
Copy link
Contributor Author

tigarmo commented Jul 31, 2024

I think the spread failures are transient (store issues looks like)

@mr-cal
Copy link
Collaborator

mr-cal commented Jul 31, 2024

Some of these spread failures are fixed on main and not hotfix/8.3. I'll get those cherry-picked.

Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, have a few questions

snapcraft/parts/plugins/python_plugin.py Outdated Show resolved Hide resolved
snapcraft/parts/plugins/python_plugin.py Outdated Show resolved Hide resolved
Copy link
Contributor

@lengau lengau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix!

snapcraft/parts/plugins/python_plugin.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@tigarmo tigarmo added the squash label Aug 1, 2024
@mr-cal
Copy link
Collaborator

mr-cal commented Aug 1, 2024

Spread failures unrelated - squash-merging

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

Successfully merging this pull request may close these issues.

3 participants