From c4dba1d56e97e51c73f8813f83bca03e8d25d722 Mon Sep 17 00:00:00 2001 From: Jim Tang Date: Thu, 25 Jul 2019 16:54:27 +0800 Subject: [PATCH] Filter out VENDOR_PYTHONPATH from PYTHONPATH in aosp. Currently when switching between internal to aosp, PYTHONPATH will be contaminated. This CL is to ensure PYTHONPATH will be as clean as opening a new terminal and source/lunch. Bug: 121106770 Test: internal: $ source build/envsetup.sh; lunch; echo $PYTHONPATH| sed 's/:/\n/g' will see VENDOR_PYTHONPATH in PYTHONPATH. switch to aosp: $ source build/envsetup.sh; lunch; echo $PYTHONPATH| sed 's/:/\n/g' won't see VENDOR_PYTHONPATH in PYTHONPATH. Change-Id: Id1916673000ee3fad55e9611d0c47cc80de86645 --- envsetup.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/envsetup.sh b/envsetup.sh index 9198ee5e5..0392e86b5 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -285,6 +285,9 @@ function setpaths() fi # and in with the new export ANDROID_PYTHONPATH=$T/development/python-packages: + if [ -n $VENDOR_PYTHONPATH ]; then + ANDROID_PYTHONPATH=$ANDROID_PYTHONPATH$VENDOR_PYTHONPATH + fi export PYTHONPATH=$ANDROID_PYTHONPATH$PYTHONPATH export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME) @@ -1552,6 +1555,7 @@ function validate_current_shell() { # # This allows loading only approved vendorsetup.sh files function source_vendorsetup() { + unset VENDOR_PYTHONPATH allowed= for f in $(find -L device vendor product -maxdepth 4 -name 'allowed-vendorsetup_sh-files' 2>/dev/null | sort); do if [ -n "$allowed" ]; then