platform_build_soong/python
Cole Faust eb3a900c5c Add flag to not add directory of entrypoint to sys.path
The python interpreter will by default add the directory of
the entrypoint script to the beginning of sys.path. This
can be disabled in python 3.11+ (which is not released yet)
using the PYTHON_SAFE_PATH environment variable or the -P flag.
As a workaround to have this behavior in older python versions,
we can make an __soong_entrypoint_redirector__.py file at the
root of the zip file that is the entrypoint, and then that
file will redirect to the real entrypoint.

This brings non-embedded-launcher python modules closer to
the embedded launcher version. The embedded launcher binaries
already act like this because they start at an __main__.py file
at the root of the zip file.

Bug: 245583294
Test: m py_dont_import_folder_of_entrypoint_test && out/host/linux-x86/nativetest64/py_dont_import_folder_of_entrypoint_test/py_dont_import_folder_of_entrypoint_test
Change-Id: I39aaf04fb19c3ba7f5c9d98220872d6d08abf736
2022-09-26 11:22:38 -07:00
..
scripts Add flag to not add directory of entrypoint to sys.path 2022-09-26 11:22:38 -07:00
tests Add flag to not add directory of entrypoint to sys.path 2022-09-26 11:22:38 -07:00
Android.bp Add preparers for python 2021-03-17 23:56:29 +00:00
androidmk.go Move common test_options properties into the android package 2022-08-17 01:19:15 +08:00
binary.go Add flag to not add directory of entrypoint to sys.path 2022-09-26 11:22:38 -07:00
builder.go Add flag to not add directory of entrypoint to sys.path 2022-09-26 11:22:38 -07:00
defaults.go Remove empty DepsMutator methods 2019-02-01 17:17:58 -08:00
installer.go Revert "Fix python_binary_host module in mixed build." 2021-11-03 09:07:26 +00:00
library.go Allowlist apexer for bp2build 2022-06-09 13:28:25 -07:00
proto.go Pass pctx and ctx to NewRuleBuilder 2020-12-01 16:22:16 -08:00
python.go Add flag to not add top-level modules to PYTHONPATH 2022-09-23 11:06:11 -07:00
python_test.go Add flag to not add top-level modules to PYTHONPATH 2022-09-23 11:06:11 -07:00
test.go Move common test_options properties into the android package 2022-08-17 01:19:15 +08:00
testing.go Add preparers for python 2021-03-17 23:56:29 +00:00