You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							46 lines
						
					
					
						
							1.3 KiB
						
					
					
				
			
		
		
	
	
							46 lines
						
					
					
						
							1.3 KiB
						
					
					
				#!/usr/bin/env bash
 | 
						|
set -e
 | 
						|
 | 
						|
# Increase the pip timeout to handle TimeoutError
 | 
						|
export PIP_DEFAULT_TIMEOUT=200
 | 
						|
 | 
						|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 | 
						|
ROOT=$DIR/../
 | 
						|
cd $ROOT
 | 
						|
 | 
						|
RC_FILE="${HOME}/.$(basename ${SHELL})rc"
 | 
						|
if [ "$(uname)" == "Darwin" ] && [ $SHELL == "/bin/bash" ]; then
 | 
						|
  RC_FILE="$HOME/.bash_profile"
 | 
						|
fi
 | 
						|
 | 
						|
if ! command -v "poetry" > /dev/null 2>&1; then
 | 
						|
  echo "installing poetry..."
 | 
						|
  curl -sSL https://install.python-poetry.org | python3 -
 | 
						|
  POETRY_BIN='$HOME/.local/bin'
 | 
						|
  ADD_PATH_CMD="export PATH=\"$POETRY_BIN:\$PATH\""
 | 
						|
  eval $ADD_PATH_CMD
 | 
						|
  printf "\n#poetry path\n$ADD_PATH_CMD\n" >> $RC_FILE
 | 
						|
fi
 | 
						|
 | 
						|
poetry config virtualenvs.prefer-active-python true --local
 | 
						|
poetry config virtualenvs.in-project true --local
 | 
						|
 | 
						|
echo "PYTHONPATH=${PWD}" > $ROOT/.env
 | 
						|
if [[ "$(uname)" == 'Darwin' ]]; then
 | 
						|
  echo "# msgq doesn't work on mac" >> $ROOT/.env
 | 
						|
  echo "export ZMQ=1" >> $ROOT/.env
 | 
						|
  echo "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" >> $ROOT/.env
 | 
						|
fi
 | 
						|
 | 
						|
poetry self add poetry-dotenv-plugin@^0.1.0
 | 
						|
 | 
						|
echo "installing python packages..."
 | 
						|
poetry install --no-cache --no-root
 | 
						|
 | 
						|
[ -n "$POETRY_VIRTUALENVS_CREATE" ] && RUN="" || RUN="poetry run"
 | 
						|
 | 
						|
if [ "$(uname)" != "Darwin" ] && [ -e "$ROOT/.git" ]; then
 | 
						|
  echo "pre-commit hooks install..."
 | 
						|
  $RUN pre-commit install
 | 
						|
  $RUN git submodule foreach pre-commit install
 | 
						|
fi
 | 
						|
 |