indygreg / PyOxidizer

A modern Python application packaging and distribution tool
Mozilla Public License 2.0
5.32k stars 227 forks source link

How to exclude `{package}-{version}.dist-info` folders in packaging results? #701

Closed WankkoRee closed 1 year ago

WankkoRee commented 1 year ago

I set policy.resources_location = "filesystem-relative:prefix".

And then I found that it will adding extra file {package}-{version}.dist-info folders to prefix/.

image

image

But I don't need these folders. Beacuse I try to delete them and try to open my exe again, it still worked.

WankkoRee commented 1 year ago

solved by policy.register_resource_callback(resource_callback).

def resource_callback(policy, resource):
    res_type = type(resource)
    if res_type == "PythonPackageDistributionResource":
        # exclude all `.dist-info` folders
        resource.add_include = False