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

add libffi-7.dll to pypy on windows #2141

Merged
merged 3 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/2141.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add libffi-7.dll to the hard-coded list of dlls for PyPy
2 changes: 1 addition & 1 deletion src/virtualenv/create/via_global_ref/builtin/pypy/pypy2.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def modules(cls):

@classmethod
def _shared_libs(cls):
return ["libpypy-c.dll"]
return ["libpypy-c.dll", "libffi-7.dll"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this need to be version limited to newer pypy versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, the code to copy ignores missing files

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, 🤔 wonder why 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

python_dir = Path(interpreter.system_executable).resolve().parent
for libname in cls._shared_libs():
src = python_dir / libname
if src.exists():
yield src

Copy link
Contributor

Choose a reason for hiding this comment

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

Will it work without this DLL? Should we make it hard dependency rather than soft that it is now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Currently this DLL is soft depdency (so assuming that's not a bug), if in the future this is not the case we should make it hard dependency and version guard the hard dependency part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be nice to avoid this code altogether in favor of a more robust solution

Copy link
Contributor

Choose a reason for hiding this comment

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

That wasn't my question. Can we say a usecase where pypy would work without this DLL with the current less robust solution? If yes, we can keep it a soft dependency. If not, it must be hard depedency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure what you mean, sorry. PyPy v7.3.5 will not have the libffi-7.dll and will work without it. Once the branch to add the dll gets merged, any future PyPy versions will require the dll. I am hopeful that branch will be merged before the PyPy v7.3.6 release, but it is dependent on a new release of virtualenv with this PR or one similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the other hand, I can envision a scenario where a packager like conda uses some OS-level utilities to avoid copying the dll. In this case even though the dlls are required, they are not copied by this code into the new virtualenv.


@classmethod
def sources(cls, interpreter):
Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ def bin_dir(self):

@classmethod
def _shared_libs(cls):
return ["libpypy3-c.dll"]
return ["libpypy3-c.dll", "libffi-7.dll"]