install.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. set -e
  3. set -x
  4. # Travis clones with depth=50 which might be too shallow for git describe, see https://github.com/pypa/setuptools_scm/issues/93
  5. git fetch --unshallow --tags
  6. if [ "${TRAVIS_OS_NAME}" = "osx" ]
  7. then
  8. # Update brew itself
  9. export HOMEBREW_NO_AUTO_UPDATE=1 # Auto-updating everything would take too much time
  10. brew update > /dev/null
  11. brew cleanup # Preempt possible scheduled clean-up so it doesn't clutter the log later
  12. # Install and/or upgrade dependencies
  13. brew install lz4 || brew upgrade lz4
  14. brew install xz || brew upgrade xz # Required for Python lzma module
  15. brew install Caskroom/cask/osxfuse || brew upgrade Caskroom/cask/osxfuse # Required for Python llfuse module
  16. brew install pyenv || brew upgrade pyenv
  17. # Configure pkg-config to use OpenSSL 1.1 from Homebrew
  18. export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig:${PKG_CONFIG_PATH}"
  19. # Configure pyenv with Python version according to TOXENV
  20. eval "$(pyenv init -)"
  21. if [ "${TOXENV}" = "py35" ]
  22. then
  23. pyenv install 3.5.3 # Minimum version for OpenSSL 1.1.x
  24. pyenv global 3.5.3
  25. elif [ "${TOXENV}" = "py37" ]
  26. then
  27. pyenv install 3.7.0
  28. pyenv global 3.7.0
  29. else
  30. printf '%s\n' "Unexpected value for TOXENV environment variable"
  31. exit 1
  32. fi
  33. pyenv rehash
  34. elif [ "${TRAVIS_OS_NAME}" = "linux" ]
  35. then
  36. # Install dependencies
  37. sudo apt-get update
  38. sudo apt-get install -y pkg-config fakeroot
  39. sudo apt-get install -y liblz4-dev
  40. sudo apt-get install -y libacl1-dev
  41. sudo apt-get install -y libfuse-dev fuse # Required for Python llfuse module
  42. else
  43. printf '%s\n' "Unexpected value for TRAVIS_OS_NAME environment variable"
  44. exit 1
  45. fi
  46. # Setup and activate virtual environment
  47. python -m pip install virtualenv
  48. python -m virtualenv ~/.venv
  49. source ~/.venv/bin/activate
  50. # Install requirements
  51. pip install -r requirements.d/development.txt
  52. pip install codecov
  53. python setup.py --version
  54. # Recent versions of OS X don't allow kernel extensions which makes the osxfuse tests fail; those versions are marked with SKIPFUSE=true in .travis.yml
  55. if [ "${SKIPFUSE}" = "true" ]
  56. then
  57. truncate -s 0 requirements.d/fuse.txt
  58. pip install -e .
  59. else
  60. pip install -e .[fuse]
  61. fi