Skip to content

Instantly share code, notes, and snippets.

@cpelley
Last active September 26, 2016 13:07
Show Gist options
  • Save cpelley/35020289a28253116a82 to your computer and use it in GitHub Desktop.
Save cpelley/35020289a28253116a82 to your computer and use it in GitHub Desktop.
Conda Iris development build script
# THE FOLLOWING SCRIPT IS TO BE PLACED AND RUN IN THE CLONE OF
# THE IRIS REPOSITORY - https://github.com/SciTools/iris
#
# The script is for installing iris to make developments in iris.
# To install iris as simply a user of iris see:
# https://gist.github.com/cpelley/5a89f44cf9288308be3f
#
# Assumes user is working with conda, if not please change
# 'ENVIRONMENT_PATH' to point to the directory of your choosen
# python interpreter.
set -e
# Specify your sample and test data directories
LOCAL_GIT_DIR="${HOME}/git"
SAMPLE_DIR="${LOCAL_GIT_DIR}/iris-sample-data"
TEST_DIR="${LOCAL_GIT_DIR}/iris-test-data"
# By default the Python environment is populated with an activated
# conda environment path (similarly the path to any path could be
# specified here).
ENVIRONMENT_PATH=${CONDA_PREFIX}
mkdir -p ${LOCAL_GIT_DIR}
get_latest_data(){
local test_dir=$1
local repo_uri=$2
if [ ! -d $test_dir ]; then
cd ${LOCAL_GIT_DIR}; git clone $repo_uri --depth 1; cd -
else
cd $test_dir; git clean -xdf; git reset HEAD --hard;
git fetch origin; git checkout origin/master; cd -
fi
}
get_latest_data ${SAMPLE_DIR} '[email protected]:SciTools/iris-sample-data.git'
get_latest_data ${TEST_DIR} '[email protected]:SciTools/iris-test-data.git'
# Clean the subfolders
git clean -xdf docs/
git clean -xdf lib/
# Create site config
cat > lib/iris/etc/site.cfg <<EOL
[System]
udunits2_path = ${ENVIRONMENT_PATH}/lib/libudunits2.so
[Resources]
sample_data_dir = ${SAMPLE_DIR}/sample_data
test_data_dir = ${TEST_DIR}/test_data
doc_dir = $(pwd)/docs/iris
EOL
# pth
echo ${PWD}/lib > ${ENVIRONMENT_PATH}/lib/python2.7/site-packages/iris.pth
# Build Iris
python setup.py --with-unpack build_ext --include-dirs=${ENVIRONMENT_PATH}/include --library-dirs=${ENVIRONMENT_PATH}/lib --inplace
python setup.py std_names
python setup.py pyke_rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment