Skip to content

Instantly share code, notes, and snippets.

@mbarkhau
Created August 23, 2020 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbarkhau/d38a4bf5d1b0c7b0f7f10c4bbd699e39 to your computer and use it in GitHub Desktop.
Save mbarkhau/d38a4bf5d1b0c7b0f7f10c4bbd699e39 to your computer and use it in GitHub Desktop.
A script to install conda and various python interpreters to use with tox
#!/bin/bash
set -e;
# change this
PROJECT_NAME=bidict
CONDA_ROOT=$HOME/miniconda3
CONDA_BIN=${CONDA_ROOT}/bin/conda
PLATFORM=$(uname -s)
if [[ ! -f ${CONDA_BIN} ]]; then
echo "installing miniconda ...";
if [[ ${PLATFORM} == "Linux" ]]; then
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" --location > .tmp_miniconda3.sh;
elif [[ ${PLATFORM} == "Darwin" ]]; then
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh" --location > .tmp_miniconda3.sh;
elif [[ ${PLATFORM} == "MINGW64_NT-10.0" ]]; then
# untested, probably doesn't work
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" --location > .tmp_miniconda3.sh;
fi;
bash .tmp_miniconda3.sh -b -p ${CONDA_ROOT};
# cleanup install script
rm .tmp_miniconda3.sh;
fi
source ${CONDA_ROOT}/etc/profile.d/conda.sh
# if [[ ! $(conda env list | grep ${PROJECT_NAME}-py27) ]]; then conda create --yes --name ${PROJECT_NAME}-py27 --channel conda-forge python=2.7; fi
if [[ ! $(conda env list | grep ${PROJECT_NAME}-py36) ]]; then conda create --yes --name ${PROJECT_NAME}-py36 --channel conda-forge python=3.6; fi
if [[ ! $(conda env list | grep ${PROJECT_NAME}-py37) ]]; then conda create --yes --name ${PROJECT_NAME}-py37 --channel conda-forge python=3.7; fi
if [[ ! $(conda env list | grep ${PROJECT_NAME}-py38) ]]; then conda create --yes --name ${PROJECT_NAME}-py38 --channel conda-forge python=3.8; fi
if [[ ! $(conda env list | grep ${PROJECT_NAME}-py38) ]]; then conda create --yes --name ${PROJECT_NAME}-pypy36 --channel conda-forge pypy3.6; fi
PATH=$(ls -d $HOME/miniconda3/envs/${PROJECT_NAME}-* | sed -z 's!\n!/bin:!g')$PATH
DEBUG=${DEBUG-0}
if [[ $DEBUG -eq 1 ]]; then
echo $PATH;
# python2.7 --version;
python3.6 --version;
python3.7 --version;
python3.8 --version;
pypy3 --version;
fi
python3.8 -m tox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment