lkajsdlakjsdlaksj
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
_ns() {
|
||||
local is_dev=$1; shift # "true" or "false"
|
||||
local args=()
|
||||
if $is_dev; then
|
||||
local arg_suffix="^*"
|
||||
else
|
||||
local arg_suffix=""
|
||||
fi
|
||||
local args=()
|
||||
for pkg in "$@"; do
|
||||
if [[ "$pkg" = -- ]]; then
|
||||
break
|
||||
@@ -19,13 +19,13 @@ _ns() {
|
||||
|
||||
# Run anything after -- as a command
|
||||
local cmd=("$@")
|
||||
while [[ "${#cmd[@]}" -gt 2 && ${cmd[0]} != "--" ]]; do
|
||||
while [[ "${#cmd[@]}" -gt 1 && "${cmd[0]}" != "--" ]]; do
|
||||
cmd=("${cmd[@]:1}")
|
||||
done
|
||||
cmd=("${cmd[@]:1}")
|
||||
if [[ ${#cmd[@]} -gt 0 ]]; then
|
||||
(
|
||||
_ns false "$args"
|
||||
_ns false "${args[@]}"
|
||||
set -x
|
||||
"${cmd[@]}"
|
||||
)
|
||||
@@ -52,6 +52,7 @@ _ns() {
|
||||
readarray -d $'\n' -t storepaths_build <<<"$outpaths"
|
||||
|
||||
# traverse propagated inputs
|
||||
# this is safe since the store paths form a DAG
|
||||
# TODO: rethink this logic
|
||||
local -i idx=-1
|
||||
while [[ $((++idx)) -lt "${#storepaths_native[@]}" ]]; do
|
||||
@@ -77,42 +78,42 @@ _ns() {
|
||||
local -a add_to_include=()
|
||||
local -a add_to_pythonpath=()
|
||||
|
||||
local -A seen=()
|
||||
# for storepath in "${storepaths_native[@]}"; do
|
||||
for storepath in "${storepaths_build[@]}"; do
|
||||
if [[ -n "${seen["$storepath"]:-}" ]]; then
|
||||
continue
|
||||
fi
|
||||
seen["$storepath"]=1
|
||||
|
||||
if [[ -d "$storepath/bin" ]]; then
|
||||
add_to_path+=("$storepath/bin")
|
||||
export PATH="$storepath/bin${PATH:+":$PATH"}"
|
||||
fi
|
||||
if >/dev/null compgen -G "$storepath/lib/*.so"; then
|
||||
add_to_libs+=("$storepath"/lib/*.so)
|
||||
export LD_LIBRARY_PATH="$(IFS=: ; printf "%s" "$storepath"/lib/*.so)${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}"
|
||||
fi
|
||||
if >/dev/null compgen -G "$storepath/lib/*.so.*"; then
|
||||
add_to_libs+=("$storepath"/lib/*.so.*)
|
||||
export LD_LIBRARY_PATH="$(IFS=: ; printf "%s" "$storepath"/lib/*.so.*)${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}"
|
||||
export CMAKE_LIBRARY_PATH="$storepath/lib${CMAKE_LIBRARY_PATH:+":$CMAKE_LIBRARY_PATH"}"
|
||||
fi
|
||||
if [[ -d "$storepath/lib/pkgconfig" ]]; then
|
||||
export PKG_CONFIG_PATH="$storepath/lib/pkgconfig${PKG_CONFIG_PATH:+":$PKG_CONFIG_PATH"}"
|
||||
fi
|
||||
if [[ -d "$storepath/share" ]]; then
|
||||
add_to_share+=("$storepath/share")
|
||||
export XDG_DATA_DIRS="$storepath/share${XDG_DATA_DIRS:+":$XDG_DATA_DIRS"}"
|
||||
fi
|
||||
if [[ -d "$storepath/share/pkgconfig" ]]; then
|
||||
export PKG_CONFIG_PATH="$storepath/share/pkgconfig${PKG_CONFIG_PATH:+":$PKG_CONFIG_PATH"}"
|
||||
fi
|
||||
if [[ -d "$storepath/include" ]]; then
|
||||
export CPATH="$storepath/include${CPATH:+":$CPATH"}"
|
||||
export CMAKE_INCLUDE_PATH="$storepath/include${CMAKE_INCLUDE_PATH:+":$CMAKE_INCLUDE_PATH"}"
|
||||
fi
|
||||
if >/dev/null compgen -G "$storepath/lib/python*/site-packages"; then
|
||||
add_to_pythonpath+=("$storepath"/lib/python*/site-packages)
|
||||
export PYTHONPATH="$(IFS=: ; printf "%s" "$storepath"/lib/python*/site-packages)${PYTHONPATH:+":$PYTHONPATH"}"
|
||||
# export PYTHONNOUSERSITE=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${#add_to_path[@]}" -gt 0 ]]; then
|
||||
export PATH="$(IFS=: ; printf "%s" "${add_to_path[*]}")${PATH:+":$PATH"}"
|
||||
fi
|
||||
if [[ "${#add_to_libs[@]}" -gt 0 ]]; then
|
||||
export LD_LIBRARY_PATH="$(IFS=: ; printf "%s" "${add_to_libs[*]}")${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}"
|
||||
fi
|
||||
if [[ "${#add_to_share[@]}" -gt 0 ]]; then
|
||||
export XDG_DATA_DIRS="$(IFS=: ; printf "%s" "${add_to_share[*]}")${XDG_DATA_DIRS:+":$XDG_DATA_DIRS"}"
|
||||
fi
|
||||
if [[ "${#add_to_include[@]}" -gt 0 ]]; then
|
||||
export CPATH="$(IFS=: ; printf "%s" "${add_to_include[*]}")${CPATH:+":$CPATH"}"
|
||||
export CMAKE_INCLUDE_PATH="$(IFS=: ; printf "%s" "${add_to_include[*]}")${CMAKE_INCLUDE_PATH:+":$CMAKE_INCLUDE_PATH"}"
|
||||
fi
|
||||
if [[ "${#add_to_pythonpath[@]}" -gt 0 ]]; then
|
||||
export PYTHONPATH="$(IFS=: ; printf "%s" "${add_to_pythonpath[*]}")${PYTHONPATH:+":$PYTHONPATH"}"
|
||||
# export PYTHONNOUSERSITE=1
|
||||
fi
|
||||
}
|
||||
|
||||
ns() { _ns false "$@"; }
|
||||
|
||||
Reference in New Issue
Block a user