Add python3 embedded launcher support

Test: m par_test{,3}; build/soong/python/tests/runtest.sh
Change-Id: I9c0fac9e2947616fdeedbfc55026dc3065966e71
This commit is contained in:
Dan Willemsen
2019-11-04 19:21:04 -08:00
parent f66a280354
commit 8d4d7bee6d
4 changed files with 49 additions and 8 deletions

View File

@@ -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/")