1 | # Sets $PATH to the locations of some precompiled binaries.
|
2 | # An alternative to nix-shell.
|
3 | #
|
4 | # Usage:
|
5 | # source build/dev-shell.sh
|
6 | #
|
7 | # Note: assumes that $REPO_ROOT is $PWD.
|
8 | #
|
9 | # IMPORTANT: sourced by _build/oils.sh, so it must remain POSIX SHELL
|
10 |
|
11 | ROOT_WEDGE_DIR=/wedge/oils-for-unix.org
|
12 | # Also in build/deps.sh
|
13 | USER_WEDGE_DIR=~/wedge/oils-for-unix.org
|
14 |
|
15 | # put 'python2' in $PATH
|
16 | readonly WEDGE_PY2_DIR=$ROOT_WEDGE_DIR/pkg/python2/2.7.18/bin
|
17 | if test -d $WEDGE_PY2_DIR; then
|
18 | export PATH="$WEDGE_PY2_DIR:$PATH"
|
19 | fi
|
20 |
|
21 | # put 'python3' in $PATH
|
22 | readonly WEDGE_PY3_DIR=$ROOT_WEDGE_DIR/pkg/python3/3.10.4/bin
|
23 | # Unconditionally add it to PATH; otherwise build/deps.sh install-wedges won't
|
24 | # work
|
25 | export PATH="$WEDGE_PY3_DIR:$PATH"
|
26 |
|
27 | readonly WEDGE_BLOATY_DIR=$ROOT_WEDGE_DIR/pkg/bloaty/1.1 # not in bin
|
28 | if test -d $WEDGE_BLOATY_DIR; then
|
29 | export PATH="$WEDGE_BLOATY_DIR:$PATH"
|
30 | fi
|
31 |
|
32 | readonly WEDGE_RE2C_DIR=$ROOT_WEDGE_DIR/pkg/re2c/3.0/bin
|
33 | if test -d $WEDGE_RE2C_DIR; then
|
34 | export PATH="$WEDGE_RE2C_DIR:$PATH"
|
35 | fi
|
36 |
|
37 | # uftrace must be installed by wedge?
|
38 | readonly UFTRACE_WEDGE_DIR=$ROOT_WEDGE_DIR/pkg/uftrace/0.13/bin
|
39 | if test -d $UFTRACE_WEDGE_DIR; then
|
40 | export PATH="$UFTRACE_WEDGE_DIR:$PATH"
|
41 | fi
|
42 |
|
43 | # FALLBACK without test/spec-bin: test/spec.sh link-busybox-ash
|
44 | readonly ASH_SYMLINK_DIR="$PWD/_tmp/shells"
|
45 | if test -d $ASH_SYMLINK_DIR; then
|
46 | export PATH="$ASH_SYMLINK_DIR:$PATH"
|
47 | fi
|
48 |
|
49 | readonly WEDGE_SOUFFLE_DIR=$USER_WEDGE_DIR/pkg/souffle/2.4.1/bin
|
50 | if test -d $WEDGE_SOUFFLE_DIR; then
|
51 | export PATH="$WEDGE_SOUFFLE_DIR:$PATH"
|
52 | fi
|
53 |
|
54 | # test/spec-bin.sh builds binaries
|
55 | # This takes precedence over $ASH_SYMLINK_DIR
|
56 | readonly SPEC_DIR="$PWD/../oil_DEPS/spec-bin"
|
57 |
|
58 | if test -d $SPEC_DIR; then
|
59 | export PATH="$SPEC_DIR:$PATH"
|
60 | fi
|
61 |
|
62 | if test -d ~/R; then
|
63 | # 2023-07: Hack to keep using old versions on lenny.local
|
64 | # In 2023-04, dplyr stopped supporting R 3.4.4 on Ubuntu Bionic
|
65 | # https://cran.r-project.org/web/packages/dplyr/index.html
|
66 | export R_LIBS_USER=~/R
|
67 | else
|
68 | R_LIBS_WEDGE=~/wedge/oils-for-unix.org/pkg/R-libs/2023-04-18
|
69 | export R_LIBS_USER=$R_LIBS_WEDGE
|
70 | fi
|
71 |
|
72 | # So we can run Python 2 scripts directly, e.g. asdl/asdl_main.py
|
73 | export PYTHONPATH='.'
|
74 |
|
75 | # We can also run mycpp/mycpp_main.py directly
|
76 | #
|
77 | # But NOT bin/oils_for_unix.py (Python 2). Those need to find our stripped down
|
78 | # vendor/typing.py, but we CANNOT put vendor/ in $PYTHONPATH, because then
|
79 | # mycpp would import it and fail.
|
80 |
|
81 | readonly site_packages=lib/python3.10/site-packages
|
82 |
|
83 | #readonly PY3_LIBS_VERSION=2023-07-27
|
84 | # Use older version because containers aren't rebuild. TODO: fix this
|
85 | readonly PY3_LIBS_VERSION=2023-03-04
|
86 |
|
87 | # Note: Version should match the one in build/deps.sh
|
88 | readonly PY3_LIBS_WEDGE=$USER_WEDGE_DIR/pkg/py3-libs/$PY3_LIBS_VERSION/$site_packages
|
89 | # Unconditionally add to PYTHONPATH; otherwise build/deps.sh install-wedges
|
90 | # can't work in one shot
|
91 | export PYTHONPATH="$PY3_LIBS_WEDGE:$PYTHONPATH"
|
92 |
|
93 | MYPY_VERSION=0.780
|
94 | # TODO: would be nice to upgrade to newer version
|
95 | #readonly MYPY_VERSION=0.971
|
96 |
|
97 | # Containers copy it here
|
98 | readonly MYPY_WEDGE=$USER_WEDGE_DIR/pkg/mypy/$MYPY_VERSION
|
99 | if test -d "$MYPY_WEDGE"; then
|
100 | export PYTHONPATH="$MYPY_WEDGE:$PYTHONPATH"
|
101 | fi
|
102 |
|
103 | # Hack for misconfigured RC cluster! Some machines have the empty string in
|
104 | # their $PATH (due to some having CUDA and others not).
|
105 | #
|
106 | # TODO: I should fix the machines, and make this a FATAL error. The $PATH
|
107 | # leaks on purpose because we might want to run with nix-shell -- see
|
108 | # test/spec-common.sh.
|
109 | case $PATH in
|
110 | *::*)
|
111 | PATH=$(echo "$PATH" | sed 's/::/:/g')
|
112 | ;;
|
113 | esac
|