chore: make work-item a reusable subproject
This commit is contained in:
26
work_item/scripts/python
Executable file
26
work_item/scripts/python
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
WORK_ITEM_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
|
||||
if [ -n "${PYTHONPATH:-}" ]; then
|
||||
export PYTHONPATH="$WORK_ITEM_ROOT/src:$PYTHONPATH"
|
||||
else
|
||||
export PYTHONPATH="$WORK_ITEM_ROOT/src"
|
||||
fi
|
||||
|
||||
if command -v conda >/dev/null 2>&1; then
|
||||
conda_version=$(conda run -n base python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")' 2>/dev/null || true)
|
||||
case "$conda_version" in
|
||||
3.1[2-9]|3.[2-9][0-9]) exec conda run --no-capture-output -n base python "$@" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for python in python3.13 python3.12; do
|
||||
if command -v "$python" >/dev/null 2>&1; then
|
||||
exec "$python" "$@"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "work-item: Python 3.12 or newer is required" >&2
|
||||
exit 2
|
||||
Reference in New Issue
Block a user