indygreg / indygreg/PyOxidizer

read_package_root ignores python modules?

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

Description

hi!

it seems using `exe.read_package_root(..)` doesn't work perfectly, I have the following folder structure

```
/home/matt/data/repos/testastropy
|-- pyoxidizer.bzl
|-- alien/
| |-- __init__.py
| |__ look.py
|_ goal.py
```

my code for packaging lookslike the following:

```Python
def make_exe():
dist = default_python_distribution()

policy = dist.make_python_packaging_policy()
policy.resources_location = "in-memory"
policy.resources_location_fallback = "filesystem-relative:lib"
policy.set_resource_handling_mode("files")
policy.extension_module_filter = "all"

python_config = dist.make_python_interpreter_config()
python_config.module_search_paths = ["$ORIGIN/lib", "$ORIGIN"]
python_config.run_module = "alien.look"

exe = dist.to_python_executable(
name="apprun",
packaging_policy=policy,
config=python_config,
)

for resource in exe.pip_download(["astropy==5.0.4", "numpy", "scipy", "photutils"]):
resource.add_location = "filesystem-relative:lib"
exe.add_python_resource(resource)

main_resource = exe.read_package_root(
path="/home/matt/data/repos/testastropy",
packages=["alien", "goal"],
)
print("main resource", main_resource)
main_resource[0].add_location = "in-memory"
exe.add_python_resource(main_resource[0])
print(exe.resources)

return exe
```
My program fails to start, additionally the print I put around shows me an empty list, am I doing something wrong?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the packaging configuration in pyoxidizer.bzl and trace the read_package_root call using the provided alien and goal package arguments. Run the shown configuration and inspect why the returned resource list is empty; done means the resources are discovered and the executable starts with alien.look.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.