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 python's lib folder search on virtualenv #1467

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

DjLegolas
Copy link
Contributor

the current way to find it looks for a file that was changed after a refactor virtualenv had

@danyeaw
Copy link
Member

danyeaw commented Oct 26, 2024

Hi @DjLegolas, thanks so much for another contribution! Since there is no issue linked to this and your description is pretty brief, could you please explain more about what issue this is fixing and under which condition? It will help me with context while reviewing it. Thanks!

@DjLegolas
Copy link
Contributor Author

@danyeaw yeah sure, I just forgot to add the relevant details.

Basically, the issue happens when compiling a debug build, including python support and using a venv.
For gvsbuild to build gobject-introspection with debug support, it searches for the libs folder that should contain python's debug lib (python3x_d.lib file).
The issue it that the way of getting the base path of the interpreter was changed. Currently, the path to the base is located inside a file pyenv.cfg in the root of the venv folder. Therefor, I added the support for it.
Nevertheless, as I'm not sure that we need to still support the older way, I decided to kept it, just in case.

This issue was partially reported in #1451, but it also reports another issue with the build. I suspect it's something related to the upstream, but wasn't able to figure out yet.

Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

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

Hi @DjLegolas, got it, thanks for the explanation! I don't know of any recent changes to virtualenvs since the venv module was added in Python 3.3 with PEP 405. Looking for the pyenv.cfg file makes sense, I vote that you remove the legacy method.

the current way to find it looks for a file that was changed after a
refactor `virtualenv` had
@DjLegolas DjLegolas force-pushed the fix-py-lib-dir-finder branch from 0fd04f9 to bb1b581 Compare October 28, 2024 20:15
@DjLegolas
Copy link
Contributor Author

@danyeaw the change is not recent, and probably not related to the builtin venv module from python.
In the original virtualenv module, on versions before 20.0.0, the orig-prefix.txt was in use.
Therefor, when the python_find_libs_dir function was added back in 4583c94 (2017), the virtualenv module had only the orig-prefix.txt, but it seem it was never tested on the builtin venv module.

Looking for the pyenv.cfg file makes sense, I vote that you remove the legacy method.

I have removed the legacy part - will now only support pyvenv.cfg.

Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

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

Thanks @DjLegolas, this is a great fix!

@danyeaw danyeaw added the fix label Oct 29, 2024
@danyeaw danyeaw merged commit 6dd4f04 into wingtk:main Oct 29, 2024
8 checks passed
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.

2 participants