indygreg / indygreg/PyOxidizer

Exclude files from exe

Open
#425 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

I'm using `policy.resources_location_fallback = "filesystem-relative:lib"` and `policy.set_resource_handling_mode("files")`. Otherwise I get errors and some JSON files are not packaged. The files mode seems to blindly just take all files. I want to exclude some files, but this fails. I tried:

~~~
for resource in exe.pip_install(["-r", "../requirements.txt", "--no-deps"]):
if resource.path.endswith('pyc'):
continue
if 'dist-info' in resource.path:
continue
if '__pycache__' in resource.path:
continue
exe.add_python_resource(resource)
~~~

but still __pycache__ and pyc files are included. How to get rid of them?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the resources returned by exe.pip_install and the handling of exe.add_python_resource when files mode is enabled. Reproduce the packaging with the shown filesystem-relative fallback and check how resource.path filtering is applied; done means the requested __pycache__, pyc, and dist-info files are absent while required JSON resources remain packaged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.