You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defresource_callback(policy, resource):
iftype(resource) in ("PythonModuleSource", "PythonPackageResource", "PythonPackageDistributionResource"):
ifresource.package.startswith("rtai"):
resource.add_location="in-memory"else:
resource.add_location="filesystem-relative:lib"defmake_exe():
dist=default_python_distribution(python_version="3.9")
policy=dist.make_python_packaging_policy()
policy.register_resource_callback(resource_callback) # This line here is the issuepython_config=dist.make_python_interpreter_config()
python_config.module_search_paths= ["$ORIGIN/lib"]
python_config.run_module="rtaisite"exe=dist.to_python_executable(
name="rtai",
packaging_policy=policy,
config=python_config,
)
exe.windows_runtime_dlls_mode="always"exe.windows_subsystem="windows"exe.add_python_resources(exe.pip_install(["--use-feature", "in-tree-build", "-r", "requirements.txt"]))
returnexe
Essentially my goal is to have all dependencies be added to the library directory with their source code as normal, and have any module that starts with "rtai" be stored within memory.
If I change policy.register_resource_callback(resource_callback) to either:
policy.resources_location = "filesystem-relative:lib" or
policy.resources_location = "in-memory"
Both of those successfully build (only the filesystem version runs though due to a few of my deps not playing nice),
Nevertheless when I try and follow the resource callback docs and use policy.register_resource_callback(resource_callback) I get the following error in the build:
resolving 1 targets
resolving target install
resolving target exe
resolving Python distribution Url { url: "https://github.com/indygreg/python-build-standalone/releases/download/20210724/cpython-3.9.6-x86_64-unknown-linux-gnu-pgo-20210724T1424.tar.zst", sha256: "343e2d349779efb7d46f7eb01ec6a202bff14293616ce8103bc8060c777bb231" }
Python distribution available at /home/simon/.cache/pyoxidizer/python_distributions/cpython-3.9.6-x86_64-unknown-linux-gnu-pgo-20210724T1424.tar.zst
reading data from Python distribution...
error[PYOXIDIZER_BUILD]: error converting PythonResource to Value: DiagnosedError(Diagnostic { level: Error, message: "Cannot .package on type PythonModuleSource", code: Some("CV00"), spans: [SpanLabel { span: Span { low: Pos(164), high: Pos(180) }, label: Some(".package not supported for type PythonModuleSource"), style: Primary }] })
--> ./pyoxidizer.bzl:18:11
|
18 | exe = dist.to_python_executable(
| ___________^
19 | | name = "rtai",
20 | | packaging_policy = policy,
21 | | config = python_config,
22 | | )
| |_____^ to_python_executable()
error: error converting PythonResource to Value: DiagnosedError(Diagnostic { level: Error, message: "Cannot .package on type PythonModuleSource", code: Some("CV00"), spans: [SpanLabel { span: Span { low: Pos(164), high: Pos(180) }, label: Some(".package not supported for type PythonModuleSource"), style: Primary }] })
Any pointers about where I may have tripped up?
Thanks :),
Cheers,
Simon
The text was updated successfully, but these errors were encountered:
Hi @indygreg,
I am trying to follow the documentation here:
https://pyoxidizer.readthedocs.io/en/latest/pyoxidizer_packaging_resources.html?highlight=resource_callback#using-callbacks-to-influence-resource-attributes
Here is the excerpt from my configuration file:
Essentially my goal is to have all dependencies be added to the library directory with their source code as normal, and have any module that starts with "rtai" be stored within memory.
If I change
policy.register_resource_callback(resource_callback)
to either:policy.resources_location = "filesystem-relative:lib"
orpolicy.resources_location = "in-memory"
Both of those successfully build (only the filesystem version runs though due to a few of my deps not playing nice),
Nevertheless when I try and follow the resource callback docs and use
policy.register_resource_callback(resource_callback)
I get the following error in the build:Any pointers about where I may have tripped up?
Thanks :),
Cheers,
Simon
The text was updated successfully, but these errors were encountered: