| 1 | # Sets $PATH to the locations of some precompiled binaries.
|
| 2 | # An alternative to nix-shell.
|
| 3 | #
|
| 4 | # Also sets PYTHONPATH and R_LIBS_USER
|
| 5 | #
|
| 6 | # Note: must run under /bin/sh, because _bin/shwrap/* tools use /bin/sh
|
| 7 | #
|
| 8 | # Usage:
|
| 9 | # source build/dev-shell.sh
|
| 10 | #
|
| 11 | # Notes:
|
| 12 | # - assumes that $REPO_ROOT is $PWD.
|
| 13 | # - build/py2.sh is a slimmer version, for just python2
|
| 14 |
|
| 15 | # Include guard
|
| 16 | test -n "${__BUILD_DEV_SHELL_SH:-}" && return
|
| 17 | readonly __BUILD_DEV_SHELL_SH=1
|
| 18 |
|
| 19 | # Used by BOTH this file, build/old-wedges.sh
|
| 20 | _MYPY_VERSION=0.780
|
| 21 | _PY3_LIBS_VERSION=2023-03-04
|
| 22 | _SITE_PACKAGES=lib/python3.10/site-packages
|
| 23 |
|
| 24 | # So we can run Python 2 scripts directly, e.g. asdl/asdl_main.py
|
| 25 | # Must come before old-wedges.sh
|
| 26 | PYTHONPATH='.'
|
| 27 |
|
| 28 | #
|
| 29 | # PATH for old wedges - not available in Soil CI, but are on contributor machines
|
| 30 | #
|
| 31 |
|
| 32 | _OLD_WEDGES=build/old-wedges.sh
|
| 33 | if test -f $_OLD_WEDGES; then
|
| 34 | # note: 'source' doesn't work under /bin/sh
|
| 35 | . $_OLD_WEDGES
|
| 36 | fi
|
| 37 |
|
| 38 | #
|
| 39 | # PATH for 2025 wedges
|
| 40 | #
|
| 41 |
|
| 42 | _DEPS_BIN_DIR=$PWD/../oils.DEPS/bin
|
| 43 | if test -d $_DEPS_BIN_DIR; then
|
| 44 | PATH="$_DEPS_BIN_DIR:$PATH"
|
| 45 | fi
|
| 46 |
|
| 47 | #
|
| 48 | # R_LIBS_USER
|
| 49 | #
|
| 50 |
|
| 51 | _NEW_WEDGE_DIR=$PWD/../oils.DEPS/wedge
|
| 52 | if test -d $_NEW_WEDGE_DIR/R-libs; then
|
| 53 | R_LIBS_USER=$_NEW_WEDGE_DIR/R-libs/2023-04-18
|
| 54 | fi
|
| 55 |
|
| 56 | #
|
| 57 | # PYTHONPATH
|
| 58 | #
|
| 59 |
|
| 60 | # Unconditionally add to PYTHONPATH, to avoid ordering issues in initial build/deps.sh setup
|
| 61 | readonly _NEW_PY3_LIBS_WEDGE=$_NEW_WEDGE_DIR/py3-libs/$_PY3_LIBS_VERSION/$_SITE_PACKAGES
|
| 62 | PYTHONPATH="$_NEW_PY3_LIBS_WEDGE:$PYTHONPATH"
|
| 63 |
|
| 64 | readonly _NEW_MYPY_WEDGE=$_NEW_WEDGE_DIR/mypy/$_MYPY_VERSION
|
| 65 | if test -d "$_NEW_MYPY_WEDGE"; then
|
| 66 | PYTHONPATH="$_NEW_MYPY_WEDGE:$PYTHONPATH"
|
| 67 | fi
|
| 68 |
|
| 69 | # Hack for misconfigured RC cluster! Some machines have the empty string in
|
| 70 | # their $PATH (due to some having CUDA and others not).
|
| 71 | #
|
| 72 | # TODO: I should fix the machines, and make this a FATAL error. The $PATH
|
| 73 | # leaks on purpose because we might want to run with nix-shell -- see
|
| 74 | # test/spec-common.sh.
|
| 75 | case $PATH in
|
| 76 | *::*)
|
| 77 | PATH=$(echo "$PATH" | sed 's/::/:/g')
|
| 78 | ;;
|
| 79 | esac
|
| 80 |
|
| 81 | #
|
| 82 | # Export all vars MUTATED
|
| 83 | #
|
| 84 |
|
| 85 | # Some of them might be exported already, but that's OK
|
| 86 | export PATH PYTHONPATH R_LIBS_USER
|