https://github.com/EasyCrypt/easycrypt
Raw File
Tip revision: a79f9aeb6de046ca12210d26317fab59c175d0dd authored by Pierre-Yves Strub on 08 July 2014, 09:43:21 UTC
Fix bug w.r.t. _tools presence detection.
Tip revision: a79f9ae
ec-build-webui-env
#! /bin/bash

# --------------------------------------------------------------------
set -e

# --------------------------------------------------------------------
: ${DEST="${PWD}/_tools/webui"} # MUST BE ABSOLUTE

# --------------------------------------------------------------------
if [ "${DEST}" != "${DEST//[ ]/}" ]; then
    echo "Destination folder contains spaces" >&2
    echo "Please, set the DEST variable to a valid value" >&2
    exit 1
fi

# --------------------------------------------------------------------
MYDIR="$(cd $(dirname $0) && pwd)"

function check_cmd {
  if ! type -P "$1" >/dev/null 2>&1; then
    echo "missing program: $1. install it first" >&2
    exit 1
  fi
}

check_cmd python
check_cmd easy_install

pyver=$(python - <<EOF
import sys; v = sys.version_info
print ((v >= (2,6) and v < (3,0)) and ("%d.%d" % (v[0], v[1])) or "0")
EOF
)

if [ ${pyver} -eq 0 ]; then
  echo "invalid python version (should be >=2.6, <3)" >&2
  exit 1
fi

# --------------------------------------------------------------------
set -x

VENVLIBDIR="${DEST}/webui-env/venv/lib/python${pyver}/site-packages"

rm -rf "${DEST}" && mkdir -p "${DEST}/webui-env"

# --------------------------------------------------------------------
mkdir -p "${DEST}/webui-env/venv"
mkdir -p "${DEST}/webui-env/venv/lib/python${pyver}/site-packages"
mkdir -p "${DEST}/webui-env/venv/bin"

PYTHONPATH="${VENVLIBDIR}:${PYTHONPATH}" \
    easy_install --prefix="${DEST}/webui-env/venv" "virtualenv >=1.9"

# --------------------------------------------------------------------
PYTHONPATH="${VENVLIBDIR}:${PYTHONPATH}" \
    "${DEST}"/webui-env/venv/bin/virtualenv "${DEST}/webui-env"

# --------------------------------------------------------------------
set +x; source "${DEST}/webui-env/bin/activate"; set -x

# --------------------------------------------------------------------
pip install cython; hash -r

( cd "${MYDIR}"/../webui && pip install -e . )
back to top