OILS / mycpp / common.sh View on Github | oilshell.org

31 lines, 16 significant
1#
2# Common functions
3#
4
5# Include guard.
6test -n "${__MYCPP_COMMON_SH:-}" && return
7readonly __MYCPP_COMMON_SH=1
8
9if test -z "${REPO_ROOT:-}"; then
10 echo '$REPO_ROOT should be set before sourcing'
11 exit 1
12fi
13
14source mycpp/common-vars.sh
15
16maybe-our-python3() {
17 ### Run a command line with Python 3
18
19 # Use Python 3.10 from deps/from-tar if available. Otherwise use the system
20 # python3.
21
22 local py3_ours='../oil_DEPS/python3'
23 if test -f $py3_ours; then
24 echo "*** Running $py3_ours $@" >& 2
25 $py3_ours "$@"
26 else
27 # Use system copy
28 python3 "$@"
29 fi
30}
31