Skip to content
Snippets Groups Projects
Commit 0b687ae2 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Upload old bootstrap snippet into the package

parent c45d691f
No related branches found
No related tags found
No related merge requests found
......@@ -6,11 +6,11 @@ system. Use it and update it if you must.
## Basic conda installation
If you still don't have a basic conda installation, use `bootstrap-conda.sh` to
bootstrap a new installation:
If you still don't have a basic conda installation, use `install-conda.sh` to
create a new installation:
```sh
$ ./bootstrap-conda.sh /opt/conda
$ ./install-conda.sh /opt/conda
```
The single parameter defines the prefix of the installation. You'll use this
......@@ -38,7 +38,7 @@ The parameters are:
Once the environment is generated, you may generate the package list like this:
```sh
$ /opt/conda/bin/conda list -n bob-devel-py27 -e > devel-py27.txt
$ /opt/conda/bin/conda list -n bob-devel-py27 -e > linux/devel-py27.txt
```
......
#!/usr/bin/env bash
# Wed 17 Aug 2016 13:50:09 CEST
# Mon 8 Aug 17:40:24 2016 CEST
if [ "${#}" != 1 ]; then
echo "usage: `basename $0` <prefix>"
echo "example: `basename $0` /opt/conda"
# Creates a build environment for the current package
# $1 == conda folder (e.g. "/opt/conda")
# $2 == python version (e.g. "2.7")
# $3 == local dir for environment (e.g. "env")
if [ "${#}" -ne 3 ]; then
echo "usage: ${0} <conda-root> <python-version> <prefix>"
echo "example: ${0} /opt/conda 2.7 env"
exit 1
fi
BASEDIR=$1
CONDA=${BASEDIR}/bin/conda
MINICONDA=${HOME}/Downloads/miniconda.sh
CONDA_FOLDER=${1}
PYTHON_VERSION=${2}
PREFIX=`pwd`/${3}
WHEELS_SERVER="www.idiap.ch"
WHEELS_REPOSITORY="https://${WHEELS_SERVER}/software/bob/wheels/gitlab/"
# Determines the architecture we're using
if [ "$(uname)" == "Darwin" ]; then
ARCH="MacOSX-x86_64"
ARCH="macosx"
else
ARCH="linux"
fi
# Function for running command and echoing results
run_cmd() {
echo "[(`date +%c`)>>] Running \"${@}\"..."
${@}
if [ "$?" != "0" ]; then
echo "[(`date +%c`)!!] Command Failed \"${@}\""
exit 1
else
echo "[(`date +%c`)<<] Finished comand \"${@}\""
fi
}
# Clones the conda dev environment to use
if [ ! -d ${PREFIX} ]; then
echo "[++] Bootstrapping (clone) conda installation at ${PREFIX}..."
pyver=$(echo ${PYTHON_VERSION} | tr -d '.')
run_cmd curl --silent https://gitlab.idiap.ch/bob/bob.admin/raw/master/${ARCH}/devel-py${pyver}.txt > env.txt
run_cmd ${CONDA_FOLDER}/bin/conda create --prefix ${PREFIX} --file env.txt --yes
run_cmd ${CONDA_FOLDER}/bin/conda clean --lock
else
echo "[!!] Prefix directory ${PREFIX} exists, not re-installing..."
fi
# Source the newly created conda environment
echo "[>>] Running \"source ${CONDA_FOLDER}/bin/activate ${PREFIX}\"..."
source ${CONDA_FOLDER}/bin/activate ${PREFIX}
echo "[<<] Environment ${PREFIX} activated"
# Verify where pip is installed
use_pip=`which pip`
if [ -z "${use_pip}" ]; then
echo "[!!] Cannot find pip, aborting..."
exit 1
else
ARCH="Linux-x86_64"
echo "[++] Using pip: ${use_pip}"
fi
if [ ! -x ${MINICONDA} ]; then
mkdir -pv `dirname ${MINICONDA}`
echo "[>>] Downloading `basename ${MINICONDA}` -> ${MINICONDA}..."
curl --progress-bar https://repo.continuum.io/miniconda/Miniconda3-latest-${ARCH}.sh --output ${MINICONDA}
chmod 755 ${MINICONDA}
use_python=`which python`
if [ -z "${use_python}" ]; then
echo "[!!] Cannot find python, aborting..."
exit 1
else
echo "[++] Using python: ${use_python}"
fi
# Create root environment and add basic channels for conda
if [ ! -x ${CONDA} ]; then
echo "[>>] Creating root environment and setting basic options..."
bash ${MINICONDA} -b -p ${BASEDIR}
${CONDA} config --set show_channel_urls True
${CONDA} config --add channels conda-forge
# Install this package's build dependencies
if [ -e requirements.txt ]; then
run_cmd ${use_pip} install --find-links ${WHEELS_REPOSITORY} --use-wheel --no-index --trusted-host ${WHEELS_SERVER} --pre --requirement requirements.txt
else
echo "[!!] No requirements.txt file found, skipping 'pip install <build-deps>'..."
fi
echo "[>>] Updating conda in the root environment..."
${CONDA} update --yes -n root conda
# Install this package's test dependencies
if [ -e test-requirements.txt ]; then
run_cmd ${use_pip} install --find-links ${WHEELS_REPOSITORY} --use-wheel --no-index --trusted-host ${WHEELS_SERVER} --pre --requirement test-requirements.txt
else
echo "[!!] No test-requirements.txt file found, skipping 'pip install <test-deps>'..."
fi
# Finally, bootstrap the installation from the new environment
if [ -e bootstrap-buildout.py ]; then
run_cmd ${use_python} bootstrap-buildout.py
else
echo "[!!] No bootstrap-buildout.py file found, skipping 'buildout bootstrap'..."
fi
#!/usr/bin/env bash
# Wed 17 Aug 2016 13:50:09 CEST
if [ "${#}" != 1 ]; then
echo "usage: `basename $0` <prefix>"
echo "example: `basename $0` /opt/conda"
exit 1
fi
BASEDIR=$1
CONDA=${BASEDIR}/bin/conda
MINICONDA=${HOME}/Downloads/miniconda.sh
if [ "$(uname)" == "Darwin" ]; then
ARCH="MacOSX-x86_64"
else
ARCH="Linux-x86_64"
fi
if [ ! -x ${MINICONDA} ]; then
mkdir -pv `dirname ${MINICONDA}`
echo "[>>] Downloading `basename ${MINICONDA}` -> ${MINICONDA}..."
curl --progress-bar https://repo.continuum.io/miniconda/Miniconda3-latest-${ARCH}.sh --output ${MINICONDA}
chmod 755 ${MINICONDA}
fi
# Create root environment and add basic channels for conda
if [ ! -x ${CONDA} ]; then
echo "[>>] Creating root environment and setting basic options..."
bash ${MINICONDA} -b -p ${BASEDIR}
${CONDA} config --set show_channel_urls True
${CONDA} config --add channels conda-forge
fi
echo "[>>] Updating conda in the root environment..."
${CONDA} update --yes -n root conda
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment