| 1 | #
 | 
| 2 | # Common functions
 | 
| 3 | #
 | 
| 4 | 
 | 
| 5 | # Include guard.
 | 
| 6 | test -n "${__MYCPP_COMMON_SH:-}" && return
 | 
| 7 | readonly __MYCPP_COMMON_SH=1
 | 
| 8 | 
 | 
| 9 | if test -z "${REPO_ROOT:-}"; then
 | 
| 10 |   echo '$REPO_ROOT should be set before sourcing'
 | 
| 11 |   exit 1
 | 
| 12 | fi
 | 
| 13 | 
 | 
| 14 | source mycpp/common-vars.sh
 | 
| 15 | 
 | 
| 16 | maybe-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 | 
 |