From 6ea3599ff65355716013daf420699fe8a086b72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=BCndler?= Date: Fri, 24 Oct 2025 23:08:45 +0200 Subject: [PATCH 1/3] Don't exit script when c extension detected --- ensure_pure_cbor2.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ensure_pure_cbor2.sh b/ensure_pure_cbor2.sh index 7ba82779..3cb1ee18 100755 --- a/ensure_pure_cbor2.sh +++ b/ensure_pure_cbor2.sh @@ -16,6 +16,7 @@ CBOR2_VERSION=$(cat .cbor2_version) echo "Found cbor2 version: $CBOR2_VERSION" echo "Checking cbor2 implementation..." +set +e $PYTHON -c " import cbor2, inspect, sys decoder_path = inspect.getfile(cbor2.CBORDecoder) @@ -24,6 +25,7 @@ print(f'Implementation path: {decoder_path}') print(f'Using C extension: {using_c_ext}') sys.exit(1 if using_c_ext else 0) " +set -e if [ $? -ne 0 ]; then echo "Reinstalling cbor2 with pure Python implementation..." @@ -35,4 +37,4 @@ else fi # Clean up -rm -f .cbor2_version \ No newline at end of file +rm -f .cbor2_version From 66303d4966c1b41794e934d12b64a37a1894af3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=BCndler?= Date: Fri, 24 Oct 2025 23:12:12 +0200 Subject: [PATCH 2/3] Add uv support --- ensure_pure_cbor2.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ensure_pure_cbor2.sh b/ensure_pure_cbor2.sh index 3cb1ee18..ff577670 100755 --- a/ensure_pure_cbor2.sh +++ b/ensure_pure_cbor2.sh @@ -1,7 +1,7 @@ #!/bin/bash # Script to ensure cbor2 is installed with pure Python implementation -set -e +set -x # Check if poetry is available, otherwise use python directly if command -v poetry &> /dev/null; then @@ -16,7 +16,6 @@ CBOR2_VERSION=$(cat .cbor2_version) echo "Found cbor2 version: $CBOR2_VERSION" echo "Checking cbor2 implementation..." -set +e $PYTHON -c " import cbor2, inspect, sys decoder_path = inspect.getfile(cbor2.CBORDecoder) @@ -25,12 +24,11 @@ print(f'Implementation path: {decoder_path}') print(f'Using C extension: {using_c_ext}') sys.exit(1 if using_c_ext else 0) " -set -e if [ $? -ne 0 ]; then echo "Reinstalling cbor2 with pure Python implementation..." - $PYTHON -m pip uninstall -y cbor2 - CBOR2_BUILD_C_EXTENSION=0 $PYTHON -m pip install --no-binary cbor2 "cbor2==$CBOR2_VERSION" --force-reinstall + $PYTHON -m pip uninstall -y cbor2 || uv pip uninstall -y cbor2 + CBOR2_BUILD_C_EXTENSION=0 $PYTHON -m pip install --no-binary cbor2 "cbor2==$CBOR2_VERSION" --force-reinstall || CBOR2_BUILD_C_EXTENSION=0 uv pip install --no-binary cbor2 "cbor2==$CBOR2_VERSION" --force-reinstall echo "Successfully reinstalled cbor2 with pure Python implementation" else echo "Already using pure Python implementation of cbor2" From c1cdbbdb6e04b8d89d41f3e3b5848f8ff9be3f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=BCndler?= Date: Fri, 24 Oct 2025 23:15:02 +0200 Subject: [PATCH 3/3] Update ensure_pure_cbor2.sh --- ensure_pure_cbor2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ensure_pure_cbor2.sh b/ensure_pure_cbor2.sh index ff577670..9c50a210 100755 --- a/ensure_pure_cbor2.sh +++ b/ensure_pure_cbor2.sh @@ -27,7 +27,7 @@ sys.exit(1 if using_c_ext else 0) if [ $? -ne 0 ]; then echo "Reinstalling cbor2 with pure Python implementation..." - $PYTHON -m pip uninstall -y cbor2 || uv pip uninstall -y cbor2 + $PYTHON -m pip uninstall -y cbor2 || uv pip uninstall cbor2 CBOR2_BUILD_C_EXTENSION=0 $PYTHON -m pip install --no-binary cbor2 "cbor2==$CBOR2_VERSION" --force-reinstall || CBOR2_BUILD_C_EXTENSION=0 uv pip install --no-binary cbor2 "cbor2==$CBOR2_VERSION" --force-reinstall echo "Successfully reinstalled cbor2 with pure Python implementation" else