Merge "Add python3 embedded launcher support"
This commit is contained in:
commit
c48ea97c9c
|
@ -326,9 +326,24 @@ func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
p.properties.Version.Py3.Libs)...)
|
||||
|
||||
if p.bootstrapper != nil && p.isEmbeddedLauncherEnabled(pyVersion3) {
|
||||
//TODO(nanzhang): Add embedded launcher for Python3.
|
||||
ctx.PropertyErrorf("version.py3.embedded_launcher",
|
||||
"is not supported yet for Python3.")
|
||||
ctx.AddVariationDependencies(nil, pythonLibTag, "py3-stdlib")
|
||||
|
||||
launcherModule := "py3-launcher"
|
||||
if p.bootstrapper.autorun() {
|
||||
launcherModule = "py3-launcher-autorun"
|
||||
}
|
||||
ctx.AddFarVariationDependencies(ctx.Target().Variations(), launcherTag, launcherModule)
|
||||
|
||||
// Add py3-launcher shared lib dependencies. Ideally, these should be
|
||||
// derived from the `shared_libs` property of "py3-launcher". However, we
|
||||
// cannot read the property at this stage and it will be too late to add
|
||||
// dependencies later.
|
||||
ctx.AddFarVariationDependencies(ctx.Target().Variations(), launcherSharedLibTag, "libsqlite")
|
||||
|
||||
if ctx.Target().Os.Bionic() {
|
||||
ctx.AddFarVariationDependencies(ctx.Target().Variations(), launcherSharedLibTag,
|
||||
"libc", "libdl", "libm")
|
||||
}
|
||||
}
|
||||
default:
|
||||
panic(fmt.Errorf("unknown Python Actual_version: %q for module: %q.",
|
||||
|
@ -370,11 +385,11 @@ func (p *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
// Only Python binaries and test has non-empty bootstrapper.
|
||||
if p.bootstrapper != nil {
|
||||
p.walkTransitiveDeps(ctx)
|
||||
// TODO(nanzhang): Since embedded launcher is not supported for Python3 for now,
|
||||
// so we initialize "embedded_launcher" to false.
|
||||
embeddedLauncher := false
|
||||
if p.properties.Actual_version == pyVersion2 {
|
||||
embeddedLauncher = p.isEmbeddedLauncherEnabled(pyVersion2)
|
||||
} else {
|
||||
embeddedLauncher = p.isEmbeddedLauncherEnabled(pyVersion3)
|
||||
}
|
||||
p.installSource = p.bootstrapper.bootstrap(ctx, p.properties.Actual_version,
|
||||
embeddedLauncher, p.srcsPathMappings, p.srcsZip, p.depsSrcsZips)
|
||||
|
|
|
@ -27,6 +27,22 @@ python_test_host {
|
|||
},
|
||||
py3: {
|
||||
enabled: false,
|
||||
embedded_launcher: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
python_test_host {
|
||||
name: "par_test3",
|
||||
main: "par_test.py",
|
||||
srcs: [
|
||||
"par_test.py",
|
||||
"testpkg/par_test.py",
|
||||
],
|
||||
|
||||
version: {
|
||||
py3: {
|
||||
embedded_launcher: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ if [ -z $ANDROID_HOST_OUT ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $ANDROID_HOST_OUT/nativetest64/par_test/par_test ]; then
|
||||
echo "Run 'm par_test' first"
|
||||
if [[ ( ! -f $ANDROID_HOST_OUT/nativetest64/par_test/par_test ) || ( ! -f $ANDROID_HOST_OUT/nativetest64/par_test3/par_test3 ) ]]; then
|
||||
echo "Run 'm par_test par_test3' first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -36,4 +36,8 @@ PYTHONHOME= PYTHONPATH= $ANDROID_HOST_OUT/nativetest64/par_test/par_test
|
|||
PYTHONHOME=/usr $ANDROID_HOST_OUT/nativetest64/par_test/par_test
|
||||
PYTHONPATH=/usr $ANDROID_HOST_OUT/nativetest64/par_test/par_test
|
||||
|
||||
PYTHONHOME= PYTHONPATH= $ANDROID_HOST_OUT/nativetest64/par_test3/par_test3
|
||||
PYTHONHOME=/usr $ANDROID_HOST_OUT/nativetest64/par_test3/par_test3
|
||||
PYTHONPATH=/usr $ANDROID_HOST_OUT/nativetest64/par_test3/par_test3
|
||||
|
||||
echo "Passed!"
|
||||
|
|
|
@ -29,7 +29,13 @@ archive = sys.modules["__main__"].__loader__.archive
|
|||
|
||||
assert_equal("__name__", __name__, "testpkg.par_test")
|
||||
assert_equal("__file__", __file__, os.path.join(archive, "testpkg/par_test.py"))
|
||||
assert_equal("__package__", __package__, "testpkg")
|
||||
|
||||
# Python3 is returning None here for me, and I haven't found any problems caused by this.
|
||||
if sys.version_info[0] == 2:
|
||||
assert_equal("__package__", __package__, "testpkg")
|
||||
else:
|
||||
assert_equal("__package__", __package__, None)
|
||||
|
||||
assert_equal("__loader__.archive", __loader__.archive, archive)
|
||||
assert_equal("__loader__.prefix", __loader__.prefix, "testpkg/")
|
||||
|
||||
|
|
Loading…
Reference in New Issue