-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bash
More file actions
29 lines (29 loc) · 1.19 KB
/
Copy pathsetup.bash
File metadata and controls
29 lines (29 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# SPDX-License-Identifier: GPL-3.0
# Copyright (C) 2026 Roboparty
# Source this file in Bash after installing to this project's install/ directory.
_dexhand_setup() {
local prefix module module_dir
local -a modules=()
prefix="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/install"
if [[ ! -d "$prefix" ]]; then
printf 'Dexhand install missing: %s\n' "$prefix" >&2
return 1
fi
while IFS= read -r -d '' module; do
modules+=("$module")
done < <(find -H "$prefix" -type f -name 'dexhand_py*.so' -print0)
if (( ${#modules[@]} != 1 )); then
printf 'Expected one dexhand_py module; found %d\n' "${#modules[@]}" >&2
return 1
fi
module_dir="$(dirname -- "${modules[0]}")"
case ":${PATH-}:" in *":$prefix/bin:"*) ;; *) export PATH="$prefix/bin${PATH:+:$PATH}" ;; esac
case ":${PYTHONPATH-}:" in *":$module_dir:"*) ;; *) export PYTHONPATH="$module_dir${PYTHONPATH:+:$PYTHONPATH}" ;; esac
case ":${CMAKE_PREFIX_PATH-}:" in *":$prefix:"*) ;; *) export CMAKE_PREFIX_PATH="$prefix${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}" ;; esac
}
if _dexhand_setup; then
unset -f _dexhand_setup
else
unset -f _dexhand_setup
return 1
fi