From b3947ed7fcfb07f4949c3f6343810da9f8d4143f Mon Sep 17 00:00:00 2001 From: bcumming Date: Wed, 4 Jun 2025 18:03:41 +0200 Subject: [PATCH] replace bootstrap and external package path with... uv! --- bin/stack-config | 14 ++++++++++---- bootstrap.sh | 22 ---------------------- test_stackinator.py | 14 +++++++++++--- 3 files changed, 21 insertions(+), 29 deletions(-) delete mode 100755 bootstrap.sh diff --git a/bin/stack-config b/bin/stack-config index b0e7460e..66496991 100755 --- a/bin/stack-config +++ b/bin/stack-config @@ -1,12 +1,18 @@ -#!/usr/bin/env python3 - +#!/usr/bin/env -S uv run --script +# /// script +# requires-python = ">=3.12" +# dependencies = [ +# "jinja2", +# "jsonschema", +# "pyYAML", +# ] +# /// import pathlib import sys prefix = pathlib.Path(__file__).parent.parent.resolve() -external = prefix / 'external' -sys.path = [prefix.as_posix(), external.as_posix()] + sys.path +sys.path = [prefix.as_posix()] + sys.path from stackinator.main import main diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index f5e0705c..00000000 --- a/bootstrap.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - - -PYTHON=${PYTHON:-python3} - -pyver=$($PYTHON -V | sed -n 's/Python \([0-9]\+\)\.\([0-9]\+\)\..*/\1.\2/p') - -$PYTHON -m ensurepip --version &> /dev/null -epip=$? - -export PATH=$(pwd)/external/usr/bin:$PATH - -# Install pip for Python 3 -if [ $epip -eq 0 ]; then - $PYTHON -m ensurepip --root $(pwd)/external/ --default-pip -fi - -export PYTHONPATH=$(pwd)/external:$(pwd)/external/usr/lib/python$pyver/site-packages:$PYTHONPATH - -$PYTHON -m pip install --no-cache-dir -q --upgrade pip --target=external/ - -$PYTHON -m pip install --no-cache-dir -q -r requirements.txt --target=external/ --upgrade diff --git a/test_stackinator.py b/test_stackinator.py index c142f43d..383af852 100755 --- a/test_stackinator.py +++ b/test_stackinator.py @@ -1,11 +1,19 @@ -#!/usr/bin/env python3 +#!/usr/bin/env -S uv run --script +# /// script +# requires-python = ">=3.12" +# dependencies = [ +# "jinja2", +# "jsonschema", +# "pytest", +# "pyYAML", +# ] +# /// import pathlib import sys prefix = pathlib.Path(__file__).parent.resolve() -external = prefix / "external" -sys.path = [prefix.as_posix(), external.as_posix()] + sys.path +sys.path = [prefix.as_posix()] + sys.path import pytest # noqa: E402