Repository navigation
Desktop: find and stage PYTHONHOME beside a native-image executable (#246) - #247
Merged
Merged
Conversation
Inside a GraalVM native image, the prefix beside the executable is the fourth packaged source, and stageNativeImagePythonHome copies it there when pythonBindings.nativeImageDirectory is set.
Library: a native image finds python-multiplatform-home beside its executable; a JVM ignores a directory beside java and never asks for the executable; no directory resolves to nothing; the environment still wins. Plugin: stageNativeImagePythonHome copies the pruned prefix into the native-image directory after stagePythonHome, and copies nothing when the directory is unset.
PackagedPythonHome.resolve takes the executable lazily and, inside a native image only (org.graalvm.nativeimage.imagecode = runtime), uses <its directory>/python-multiplatform-home when it exists. The plugin's stageNativeImagePythonHome Sync copies the same pruned prefix there. Closes #246
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #246
Feature added (SPEC L-9).
PackagedPythonHome.resolvehas a fourth source. Inside a GraalVM native image only (org.graalvm.nativeimage.imagecode == runtime, read as a property, with no GraalVM SDK dependency), it uses<directory of the executable>/python-multiplatform-homewhen that directory exists. It then goes through L-3's check,Py_SetPythonHomeand the libpython lookup like the other packaged sources. The executable is a lambda, evaluated only inside a native image:ProcessHandleis never asked on a JVM, and never on Android, which lacks it on older versions; a test pins that.stageNativeImagePythonHome(aSync) copies the same pruned prefix Compose packaging gets into<pythonBindings.nativeImageDirectory>/python-multiplatform-home. It copies nothing and stages nothing unless that directory is set.Test added (red first: the plugin test failed to compile,
Unresolved reference: nativeImageDirectory):PM/desktopTest/.../PackagedPythonHomeTest: 4 new tests, 17 in total.GP/PackagedPythonHomeTest: 2 new tests, 10 in total.Verification (local):
:python-multiplatform:desktopTest: 625, 0 failed, 1 skipped.:python-multiplatform-gradle-plugin:test: 323, with the 1 environment-onlyAcquiredHeaderVersionTestfailure.compileDebugKotlinAndroid: compiles.The end-to-end use, a native image started from an empty directory, is the next PR: the notebook E2E as a native image (#191 milestone 1).