Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22f4c322 authored by Jim Tang's avatar Jim Tang
Browse files

Prevent PYTHONPATH from accumulatively growing.

After running "lunch" multiple times, the global variable
PYTHONPATH grows larger and larger with repetively content.
This patch is to prevent PYTHONPATH from prepending redundant path.

Bug: b/121110600

Test: $ source build/envsetup.sh && lunch
      $ echo $PYTHONPATH | sed 's/:/\n/g'
      $ lunch; lunch
      $ echo $PYTHONPATH | sed 's/:/\n/g' # not growing.

Change-Id: Ifc36d071fb63bb1494bb0a94fdff477a41708c74
parent 4bc5c8fe
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -266,7 +266,14 @@ function setpaths()
    fi

    export PATH=$ANDROID_BUILD_PATHS$PATH
    export PYTHONPATH=$T/development/python-packages:$PYTHONPATH

    # out with the duplicate old
    if [ -n $ANDROID_PYTHONPATH ]; then
        export PYTHONPATH=${PYTHONPATH//$ANDROID_PYTHONPATH/}
    fi
    # and in with the new
    export ANDROID_PYTHONPATH=$T/development/python-packages:
    export PYTHONPATH=$ANDROID_PYTHONPATH$PYTHONPATH

    export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME)
    export JAVA_HOME=$ANDROID_JAVA_HOME