aboutsummaryrefslogtreecommitdiff
path: root/envsetup.sh
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2023-01-26 00:07:03 +0000
committerDan Albert <danalbert@google.com>2023-01-26 00:09:21 +0000
commit0d6d3599a0d279ab77e63fab9e4f91828d55a812 (patch)
tree6a38c1572e732febcb5afe3ad462dbcfb3244d31 /envsetup.sh
parente9c253fe31f222b9bc5d24e1bee5d52778b8d9b0 (diff)
downloadbuild-0d6d3599a0d279ab77e63fab9e4f91828d55a812.tar.gz
Update PYTHONPATH for adb.py restructuring.
Importers of the adb python package like lldbclient.py and gdbrunner are broken following the restructure that enabled adb to export type info to importers. Bug: http://b/266688086 Test: adb.__file__ is no longer None after envsetup.sh/lunch Change-Id: I7bf27601e800043adee8971c093347ca9b2979a9
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/envsetup.sh b/envsetup.sh
index ab86d5ff9f..32e1a328a2 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -297,7 +297,22 @@ function set_lunch_paths()
if [ -n $ANDROID_PYTHONPATH ]; then
export PYTHONPATH=${PYTHONPATH//$ANDROID_PYTHONPATH/}
fi
- export ANDROID_PYTHONPATH=$T/development/python-packages:
+ # //development/python-packages contains both a pseudo-PYTHONPATH which
+ # mimics an already assembled venv, but also contains real Python packages
+ # that are not in that layout until they are installed. We can fake it for
+ # the latter type by adding the package source directories to the PYTHONPATH
+ # directly. For the former group, we only need to add the python-packages
+ # directory itself.
+ #
+ # This could be cleaned up by converting the remaining packages that are in
+ # the first category into a typical python source layout (that is, another
+ # layer of directory nesting) and automatically adding all subdirectories of
+ # python-packages to the PYTHONPATH instead of manually curating this. We
+ # can't convert the packages like adb to the other style because doing so
+ # would prevent exporting type info from those packages.
+ #
+ # http://b/266688086
+ export ANDROID_PYTHONPATH=$T/development/python-packages/adb:$T/development/python-packages:
if [ -n $VENDOR_PYTHONPATH ]; then
ANDROID_PYTHONPATH=$ANDROID_PYTHONPATH$VENDOR_PYTHONPATH
fi