diff --git a/buildconfig/Jenkins/dev_site.sh b/buildconfig/Jenkins/dev_site.sh index 85f6bd4682d79189b7e956a2de4befaa742fa060..ea072f8d8a910819988270ecbdb2b2b6e43dba38 100755 --- a/buildconfig/Jenkins/dev_site.sh +++ b/buildconfig/Jenkins/dev_site.sh @@ -9,64 +9,51 @@ if [ -z "$BUILD_DIR" ]; then echo "Setting BUILD_DIR to $BUILD_DIR" fi +############################################################################### +# Set up the build directory +############################################################################### if [ -d $BUILD_DIR ]; then - echo "$BUILD_DIR exists" + echo "$BUILD_DIR exists - updating existing checkout" + cd $BUILD_DIR + git pull --rebase else - mkdir $BUILD_DIR + echo "$BUILD_DIR does not exist - cloning developer site" + git clone -b gh-pages git@github.com-mantid-builder:mantidproject/developer.git $BUILD_DIR || exit -1 + cd $BUILD_DIR fi ############################################################################### -# Print out the versions of things we are using +# Setup virtualenv for building the docs ############################################################################### -# we use cmake3 on rhel because cmake is too old -if [ $(command -v cmake3) ]; then - CMAKE_EXE=cmake3 +VIRTUAL_ENV=$BUILD_DIR/virtualenv +if [[ ! -d $VIRTUAL_ENV ]]; then + virtualenv --system-site-packages "$VIRTUAL_ENV" + source $VIRTUAL_ENV/bin/activate + pip install sphinx + pip install sphinx_bootstrap_theme else - CMAKE_EXE=cmake + source $VIRTUAL_ENV/bin/activate fi -${CMAKE_EXE} --version +which python ############################################################################### -# Generator +# Build the developer site +# ----------------------------------------------------------------------------- +# the wacky long line is what is run from inside "sphinx-build" which is not +# installed by virtualenv for some reason ############################################################################### -if [ "$(command -v ninja)" ]; then - CMAKE_GENERATOR="-G Ninja" -elif [ "$(command -v ninja-build)" ]; then - CMAKE_GENERATOR="-G Ninja" -fi -##### set up the build directory -cd $BUILD_DIR -if [ -e $BUILD_DIR/CMakeCache.txt ]; then - ${CMAKE_EXE} . -else - ${CMAKE_EXE} ${CMAKE_GENERATOR} .. -fi - -if [ -d dev-docs/html ]; then - echo "Updating existing checkout" - cd dev-docs/html - git pull --rebase - cd - -else - echo "Cloning developer site" - git clone git@github.com:mantidproject/developer.git dev-docs/html || exit -1 - cd dev-docs/html - git checkout gh-pages - cd - -fi - -##### build the developer site -${CMAKE_EXE} --build . --target dev-docs-html - -cd dev-docs/html +SPHINX_VERS=$(python -c "import sphinx;print sphinx.__version__") +python -c "import sys;from pkg_resources import load_entry_point;sys.exit(load_entry_point('Sphinx==$SPHINX_VERS', 'console_scripts', 'sphinx-build')())" $WORKSPACE/dev-docs/source $BUILD_DIR +############################################################################### +# Push the results +############################################################################### if [ "builder" == "$USER" ]; then echo "Setting username" git config user.name mantid-builder git config user.email "mantid-buildserver@mantidproject.org" fi -##### push the results if [ $(git diff --quiet) ]; then echo "Committing new site" git add .