On classified versus files based resources. See Classified Resources Versus Files for more In PyOxidizer), you can fall back to using unclassified, file-based Those classified resources as files is failing (presumably due to bugs In cases where PyOxidizer’s resource classifier or logic to materialize add_location to filesystem-relative.) was attempted Work around issues importing a module from memory.Īstute readers may have already realized that this workaround How to move classified resources from memory to the filesystem in order to In Installing Classified Resources on the Filesystem we demonstrated Installing Unclassified Files on the Filesystem ¶ We’ll leave that as an exercise for the reader. Resources are materialized on the filesystem and minimize the number ofįiles present. On _file_, it is probably possible to cherry pick exactly which ![]() Oxidized_importer Python Extension can find and load resources more efficiently.īecause only some of the Python modules used by black have a dependency All of the resources are indexed by PyOxidizerĪt build time and that index is embedded into the built binary so In this configuration file, the Python distribution’s files are all loadedįrom memory but black resources (collected via pip install black) are Poke around in the install directory, you will in fact see all these ![]() That extra files are being installed to the lib/ directory. If you examine the build output, you’ll see a bunch of messages indicating That No paths given output is from black: it looks like the new Installing files to /home/gps/tmp/myapp/build/x86_64-unknown-linux-gnu/debug/install With the new configuration in place, let’s re-build and run the application:Īdding extra file lib/toml-0.10.1.dist-info/top_level.txt to. PythonExecutable.add_python_resource() to add the resourceĪs a filesystem-relative resource in the lib directory. Resource.add_location = "filesystem-relative:lib". Next, in the for resource in exe.pip_install(.) loop, we set On the filesystem, relative to the produced binary. Its PythonPackagingPolicy.resources_location_fallbackĪttribute to filesystem-relative-lib. PythonDistribution.make_python_packaging_policy() and set We constructed a new PythonPackagingPolicy via add_python_resource ( resource ) return exe add_location = "filesystem-relative:lib" exe. to_python_executable ( name = "black", packaging_policy = policy, config = python_config, ) for resource in exe. make_python_interpreter_config () python_config. resources_location_fallback = "filesystem-relative:lib" python_config = dist. The goal of our new configuration is to materialize Python resourcesĪssociated with black on the filesystem instead of in memory.Ĭhange your configuration file so make_exe() looks like the following:ĭef make_exe ( dist ): policy = dist. This will require configuration file changes. Your next mitigation should be to attempt to place the resource on the But this isn’t always trivial or possible with 3rd party ![]() Mitigation is to fix the offending Python modules so they can loadįrom memory. In scenarios where in-memory resource loading doesn’t work, the ideal Installing Classified Resources on the Filesystem ¶īlack failed to run with modules imported from memory because of See Incorrect Resource Identification andĬlassified Resources Versus Files for more. This filename mangling is actually a bug in PyOxidizer’s file/resourceĬlassification. Numpy/build/x86_64-unknown-linux-gnu/debug/install/lib/numpy/libs/libopenblasp-r0-ae94cfde/3/9/dev.so Numpy/build/x86_64-unknown-linux-gnu/debug/install/lib/numpy/libs/libopenblasp-r0-ae94cfde/3/9 Numpy/build/x86_64-unknown-linux-gnu/debug/install/lib/numpy/libs/libopenblasp-r0-ae94cfde/3 Numpy/build/x86_64-unknown-linux-gnu/debug/install/lib/numpy/libs/libopenblasp-r0-ae94cfde $ find numpy/build/x86_64-unknown-linux-gnu/debug/install/ | grep libopenblasp
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |