Fix CI
[openjpeg.git] / tools / travis-ci / install.sh
index 4e6ce69c8c936d02418ff743d2f86854cea711c0..2945398615300477e8717b1b32cc6e65b26ddffd 100755 (executable)
@@ -9,11 +9,8 @@ case ${MACHTYPE} in
 esac
 
 if [ "${OPJ_CI_IS_CYGWIN:-}" == "1" ]; then
-       # Hack for appveyor
-       if ! which wget; then
-               # PATH is not yet set up
-               export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
-       fi
+       # PATH is not yet set up
+       export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
 fi
 
 # Set-up some error handling
@@ -38,43 +35,39 @@ if [ "${COVERITY_SCAN_BRANCH:-}" == "1" ] || [ "${OPJ_CI_ABI_CHECK:-}" == "1" ];
        exit 0
 fi
 
-if [ "${OPJ_CI_ASAN:-}" == "1" ]; then
-       # We need a new version of cmake than travis-ci provides
-       wget -qO - http://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz | tar -xz
-       # copy to a directory that will not changed every version
-       mv cmake-3.3.1-Linux-x86_64 cmake-install
-fi
-
 if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
 
        OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
 
        # We need test data
-       if [ "${TRAVIS_BRANCH:-}" != "" ]; then
+       if [ "${GITHUB_HEAD_REF:-}" != "" ]; then
+               OPJ_DATA_BRANCH=${GITHUB_HEAD_REF}
+       elif [ "${TRAVIS_BRANCH:-}" != "" ]; then
                OPJ_DATA_BRANCH=${TRAVIS_BRANCH}
        elif [ "${APPVEYOR_REPO_BRANCH:-}" != "" ]; then
                OPJ_DATA_BRANCH=${APPVEYOR_REPO_BRANCH}
        else
                OPJ_DATA_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to same branch as we're setting up
        fi
-       OPJ_DATA_HAS_BRANCH=$(git ls-remote --heads git://github.com/uclouvain/openjpeg-data.git ${OPJ_DATA_BRANCH} | wc -l)
-       if [ ${OPJ_DATA_HAS_BRANCH} -ne 0 ]; then
-               OPJ_DATA_BRANCH=${TRAVIS_BRANCH}
-       else
+       OPJ_DATA_HAS_BRANCH=$(git ls-remote --heads https://github.com/uclouvain/openjpeg-data ${OPJ_DATA_BRANCH} | wc -l)
+       if [ ${OPJ_DATA_HAS_BRANCH} -eq 0 ]; then
                OPJ_DATA_BRANCH=master #default to master
        fi
        echo "Cloning openjpeg-data from ${OPJ_DATA_BRANCH} branch"
-       git clone --depth=1 --branch=${OPJ_DATA_BRANCH} git://github.com/uclouvain/openjpeg-data.git data
+       git clone -v --depth=1 --branch=${OPJ_DATA_BRANCH} https://github.com/uclouvain/openjpeg-data data
 
        # We need jpylyzer for the test suite
+    JPYLYZER_VERSION="1.17.0"    
        echo "Retrieving jpylyzer"
-       if [ "${APPVEYOR:-}" == "True" ]; then
-               wget -q http://dl.bintray.com/openplanets/opf-windows/jpylyzer_1.14.2_win32.zip
-               cmake -E tar -xf jpylyzer_1.14.2_win32.zip
-               mv jpylyzer_1.14.2_win32 jpylyzer
+       if [ "${APPVEYOR:-}" == "True" -o "${RUNNER_OS:-}" == "Windows" ]; then
+               wget -q https://github.com/openpreserve/jpylyzer/releases/download/${JPYLYZER_VERSION}/jpylyzer_${JPYLYZER_VERSION}_win32.zip
+               mkdir jpylyzer
+               cd jpylyzer
+               cmake -E tar -xf ../jpylyzer_${JPYLYZER_VERSION}_win32.zip
+               cd ..
        else
-               wget -qO - https://github.com/openpreserve/jpylyzer/archive/1.14.2.tar.gz | tar -xz
-               mv jpylyzer-1.14.2/jpylyzer ./
+               wget -qO - https://github.com/openpreserve/jpylyzer/archive/${JPYLYZER_VERSION}.tar.gz | tar -xz
+               mv jpylyzer-${JPYLYZER_VERSION}/jpylyzer ./
                chmod +x jpylyzer/jpylyzer.py
        fi
 
@@ -84,30 +77,40 @@ if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
        # so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.
        # Note: Binaries can only be used for non-commercial purposes.
        if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then
-               if [ "${TRAVIS_OS_NAME:-}" == "linux" ] || uname -s | grep -i Linux &> /dev/null; then
+               if [ "${TRAVIS_OS_NAME:-}" == "linux" -o "${RUNNER_OS:-}" == "Linux" ] || uname -s | grep -i Linux &> /dev/null; then
                        echo "Retrieving Kakadu"
-                       wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip
-                       cmake -E tar -xf KDU77_Demo_Apps_for_Linux-x86-64_150710.zip
-                       mv KDU77_Demo_Apps_for_Linux-x86-64_150710 kdu
-               elif [ "${TRAVIS_OS_NAME:-}" == "osx" ] || uname -s | grep -i Darwin &> /dev/null; then
+                       wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Linux-x86-64_200602.zip
+                       cmake -E tar -xf KDU805_Demo_Apps_for_Linux-x86-64_200602.zip
+                       mv KDU805_Demo_Apps_for_Linux-x86-64_200602 kdu
+               elif [ "${TRAVIS_OS_NAME:-}" == "osx"  -o "${RUNNER_OS:-}" == "macOS" ] || uname -s | grep -i Darwin &> /dev/null; then
                        echo "Retrieving Kakadu"
-                       wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip
-                       cmake -E tar -xf KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip
+                       wget -v http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
+                       cmake -E tar -xf KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
                        wget -q http://downloads.sourceforge.net/project/catacombae/HFSExplorer/0.23/hfsexplorer-0.23-bin.zip
                        mkdir hfsexplorer && cmake -E chdir hfsexplorer tar -xf ../hfsexplorer-0.23-bin.zip
-                       ./hfsexplorer/bin/unhfs.sh -o ./ -fsroot Kakadu-demo-apps.pkg  KDU77_Demo_Apps_for_OSX109_150710.dmg
+                       ./hfsexplorer/bin/unhfs.sh -o ./ -fsroot Kakadu-demo-apps.pkg  KDU805_Demo_Apps_for_MacOS_200602.dmg
                        pkgutil --expand Kakadu-demo-apps.pkg ./kdu
                        cd kdu
-                       cat libkduv77r.pkg/Payload | gzip -d | cpio -id
+                       cat libkduv80r.pkg/Payload | gzip -d | cpio -id
                        cat kduexpand.pkg/Payload | gzip -d | cpio -id
                        cat kducompress.pkg/Payload | gzip -d | cpio -id
-                       install_name_tool -id ${PWD}/libkdu_v77R.dylib libkdu_v77R.dylib 
-                       install_name_tool -change /usr/local/lib/libkdu_v77R.dylib ${PWD}/libkdu_v77R.dylib kdu_compress
-                       install_name_tool -change /usr/local/lib/libkdu_v77R.dylib ${PWD}/libkdu_v77R.dylib kdu_expand
-               elif [ "${APPVEYOR:-}" == "True" ]; then
-                       wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Win32_150710.msi_.zip
-                       cmake -E tar -xf KDU77_Demo_Apps_for_Win32_150710.msi_.zip
-                       msiexec /i KDU77_Demo_Apps_for_Win32_150710.msi /quiet /qn /norestart
+                       install_name_tool -id ${PWD}/libkdu_v80R.dylib libkdu_v80R.dylib 
+                       install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_compress
+                       install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_expand
+               elif [ "${APPVEYOR:-}" == "True" -o "${RUNNER_OS:-}" == "Windows"  ] || uname -s | grep -i MINGW &> /dev/null || uname -s | grep -i CYGWIN &> /dev/null; then
+                       echo "Retrieving Kakadu"
+                       wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Win64_200602.msi_.zip
+                       cmake -E tar -xf KDU805_Demo_Apps_for_Win64_200602.msi_.zip
+                       msiexec /i KDU805_Demo_Apps_for_Win64_200602.msi /quiet /qn /norestart
+                       if [ -d "C:/Program Files/Kakadu" ]; then
+                               cp -r "C:/Program Files/Kakadu" ./kdu
+                       else
+                               cp -r "C:/Program Files (x86)/Kakadu" ./kdu
+                       fi
                fi
        fi
 fi
+
+if [ "${OPJ_CI_CHECK_STYLE:-}" == "1" ]; then
+    pip install --user autopep8
+fi