1#!/bin/bash
2#
3# Copyright 2016 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18if [ -z "$ANDROID_BUILD_TOP" ]; then
19  echo "Please run the lunch command first."
20elif [ -z "$VTS_PYPI_PATH" ]; then
21  echo "Please set environment variable VTS_PYPI_PATH as a new directory to host all PyPI packages."
22else
23  echo "Local PyPI packages directory is set to" $VTS_PYPI_PATH
24  echo "Making local dir" $VTS_PYPI_PATH
25
26  if [ -d "$VTS_PYPI_PATH" ]; then
27    echo $VTS_PYPI_PATH "already exists"
28  else
29    mkdir $VTS_PYPI_PATH -p
30  fi
31
32  echo "Downloading PyPI packages to" $VTS_PYPI_PATH
33  pip download -d $VTS_PYPI_PATH -r $ANDROID_BUILD_TOP/test/vts/script/pip_requirements.txt --no-binary protobuf,grpcio,numpy,Pillow,scipy
34  # The --no-binary option is necessary for packages that have a
35  # "-cp27-cp27mu-manylinux1_x86_64.whl" version that will be downloaded instead
36  # if --no-binary option is not specified. This version is not compatible with
37  # the python virtualenv set up by VtsPythonVirtualenvPreparer.
38
39  # TODO(jaeshin): b/38371975, fix matplotlib download error
40  pip download -d $VTS_PYPI_PATH matplotlib --no-binary matplotlib,numpy
41fi
42