1SCRIPT_DIR="$(cd $(dirname $0) && pwd)"
2
3if [ "$(uname)" = "Darwin" ]; then
4  VIRTUAL_ENV_INSTALL_COMMAND="pip3 install virtualenv"
5  else
6  VIRTUAL_ENV_INSTALL_COMMAND="sudo apt-get install virtualenv python3-venv"
7fi
8
9
10# check if virtualenv is installed
11if !(pyenv_version=$(virtualenv --version > /dev/null 2>&1)); then
12  echo "virtualenv is not installed. Please install with '$VIRTUAL_ENV_INSTALL_COMMAND'"
13  exit 1
14fi
15
16# create virtualenv
17virtualenv androidx_project_creator
18
19# install necessary tools
20androidx_project_creator/bin/pip3 install setuptools toml
21
22# run project creator
23androidx_project_creator/bin/python3 $SCRIPT_DIR/create_project.py "$@"
24
25
26# clean up virtualenv directory
27rm -rf ./androidx-project_creator
28