Skip to content

Instantly share code, notes, and snippets.

@jclulow jclulow/create_environment.sh Secret

Created Apr 30, 2020
Embed
What would you like to do?
#!/bin/bash
if [[ -z $SYNAPSE_VERSION ]]; then
SYNAPSE_VERSION=1.12.0
fi
function fatalf {
local fmt="ERROR: $1\n"
shift
printf "$fmt" "$@" >&2
exit 1
}
function infof {
local fmt='\e[1;7m * '"$1"'\e[0m\n'
shift
printf "$fmt" "$@" >&2
}
name=$1
if [[ -z $name ]]; then
fatalf 'provide environment name'
fi
dir="$HOME/env-$name"
if [[ -d $dir ]]; then
fatalf 'directory "%s" exists already' "$dir"
fi
set -o errexit
set -o pipefail
infof 'CREATE ENVIRONMENT "%s"' "$dir"
virtualenv -p python3 "$dir"
infof 'ACTIVATE ENVIRONMENT "%s"' "$dir"
. "$dir/bin/activate"
infof 'INSTALL pip'
pip install --upgrade pip
infof 'INSTALL setuptools'
pip install --upgrade setuptools
infof 'INSTALL matrix'
LDFLAGS='-L/opt/local/lib -R/opt/local/lib'
LDFLAGS+=' /opt/local/lib/libssl.so'
LDFLAGS+=' /opt/local/lib/libcrypto.so'
export LDFLAGS
CFLAGS='-I/opt/local/include'
export CFLAGS
export CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=yes
pip install --upgrade "matrix-synapse[postgres]==$SYNAPSE_VERSION"
infof 'COMPLETED ENVIRONMENT "%s" @ "%s"' "$name" "$dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.