Closed adferrand closed 5 years ago
Hello, and thanks for the detailed report. :-)
I'm pretty sure there's no good reason .dist-info
directories need to be excluded. I think I wrote that line before I really knew what they were for, and they seemed to be unnecessary to make an application work, so I left them out.
Now that I know what .dist-info
directories are useful for, I think I'd say we should just put them in, and don't bother adding a new option for them. Options are more complexity in the code, and another thing for people using Pynsist to figure out. I can't see any likely scenario where including the .dist-info
directory would be a problem. They don't tend to be very big, and I'd rather make installers that work reliably than installers that are as small as possible.
Hello @takluyver, I followed what you said. My PR does not add any configuration parameter, and copy the package metadata for wheels and for importable modules.
Hello!
I am trying to build a NSIS installer for Certbot (https://github.com/certbot/certbot) using pynsist. So far, I managed to create a build process that:
However, when I try to run the software installed with the generated installer, it fails. After some digging, I understood that Certbot is using the plugins discovery functionality through package metadata. See this link https://packaging.python.org/guides/creating-and-discovering-plugins/ on section Using package metadata for more information about this mechanism.
To sum up, it requires that the package metadata are installed along with the python code of each package in the typical
site-package
folder of the local Python installation. These metadata take the form of a folder whose name are the package name + package version + the suffix.dist-info
(for instance, metadata offuture
package is the folderfuture-0.16.0.dist-info
).However in the
pkgs
directory created by an installer compiled using pynsist, these*.dist-info
folders are missing, thus breaking the capability of Python to use the plugins discovery functionality. Adding manually these folders corrects the problem.Normally theses folders are automatically installed or packaged through any relevant call to
pip install
. In particular, they are present in the wheels generated usingpip wheel
, or when downloaded from PyPi. But in the code of pynsist, there is this line, when wheels are extracted to be copied in the pkg directory: https://github.com/takluyver/pynsist/blob/0108e1243fbeab2fd480ba775f04205bdceee7b2/nsist/pypi.py#L232So
*.dist-info
folders are explicitly forbidden to be copied inpkgs
. Similarly, there is no code done to handle the*.dist-info
of the application module.Before I open a PR, I would like to know if there is a reason why the
*.dist-info
folders are explicitly excluded. If not, I would make a PR to add onpackage_metadata
to the[Include]
section (default tofalse
) of aninstaller.cfg
, in order to allow people who need this functionality to build installers that include theses folders.Regards, Adrien Ferrand