diff --git a/rpm/nsd-app-wrap.spec b/rpm/nsd-app-wrap.spec index 634294f3fa0fbf91fad8d799d4e89d411be915a9..c330d0d30039b0877dc2c7a87641ea494ac271d2 100644 --- a/rpm/nsd-app-wrap.spec +++ b/rpm/nsd-app-wrap.spec @@ -1,5 +1,5 @@ Name: nsd-app-wrap -Version: 2.16 +Version: 2.17 Release: 1%{?dist} Summary: Wrapper scripts to launch python applications installed via anaconda Vendor: Peter F. Peterson @@ -47,6 +47,7 @@ install -m 755 mcstas %{buildroot}%{_bindir}/ install -m 755 nr_launcher %{buildroot}%{_bindir}/ install -m 755 nsd-app-wrap.sh %{buildroot}%{_bindir}/ install -m 755 nsd-conda-wrap.sh %{buildroot}%{_bindir}/ +install -m 755 nsd-pixi-shell.sh %{buildroot}%{_bindir}/ install -m 755 nseplot %{buildroot}%{_bindir}/ install -m 755 nxs2taco %{buildroot}%{_bindir}/ install -m 755 paraview %{buildroot}%{_bindir}/ @@ -107,6 +108,9 @@ install -m 644 desktop/ibeatles.desktop %{buildroot}%{_datadir}/a %{_prefix}/share/applications/* %changelog +* Mon Jan 05 2026 Pete Peterson +- Add nsd-pixi-shell.sh for activating an environment + * Tue Dec 16 2025 John Hetrick - Added nxs2taco, a pysen utility diff --git a/src/nsd-app-wrap.sh b/src/nsd-app-wrap.sh index c75a94e32b3af7934f3e07c344a0dd99e3847853..f21218b62d02321dc3efd0426589f69b8d313a66 100755 --- a/src/nsd-app-wrap.sh +++ b/src/nsd-app-wrap.sh @@ -19,7 +19,11 @@ _get_pixi_manifest_path() { # pixi environment PIXI_ENV="${1}" - echo "${PIXI_PREFIX%/}/${PIXI_ENV}" + if [ -d "${PIXI_ENV}" ]; then + echo "${PIXI_ENV}" + else + echo "${PIXI_PREFIX%/}/${PIXI_ENV}" + fi } ########## Activate the environment in the central pixi install @@ -36,6 +40,7 @@ activate_pixi_environment () { fi # activate the environment + echo "Activating ${PIXI_ENV} environment. Type 'exit' to exit." pixi shell --frozen --manifest-path "${_path_to_manifest}" } diff --git a/src/nsd-pixi-shell.sh b/src/nsd-pixi-shell.sh new file mode 100755 index 0000000000000000000000000000000000000000..cafbd43486f52604387f24d9cf5e89f9c88f5a96 --- /dev/null +++ b/src/nsd-pixi-shell.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +_usage() { + echo "usage: $0 [tool arguments]" +} + +# select the environment to use +if [ -n "$1" ]; then + if [ "$1" == "--help" ]; then + _usage + exit 0 + elif [ "$1" == "-h" ]; then + _usage + exit 0 + fi + PIXI_ENVIRON="$1" + shift # drop this argument +else + echo "Must specify a conda environment to activate" + _usage + exit 255 +fi + +# import library to do the real work +# shellcheck disable=SC1091 +. "$(dirname "$(realpath "$0")")/nsd-app-wrap.sh" || + . /bin/nsd-app-wrap.sh + +activate_pixi_environment "${PIXI_ENVIRON}"