@@ -330,11 +330,49 @@ jobs:
330330 run : |
331331 # Install Python 3.9+ (any version will work with abi3-py39)
332332 apt-get update -y
333- apt-get install -y python3 python3-dev
333+ apt-get install -y python3 python3-dev patchelf
334+
335+ echo "=== Starting test setup ==="
336+ echo "Current directory: $(pwd)"
337+ echo "Python version: $(python3 --version)"
338+ echo "Patchelf version: $(patchelf --version)"
339+
340+ # Check what .node files exist
341+ echo "=== Available .node files ==="
342+ ls -la *.node || echo "No .node files found"
343+
344+ # Find Linux .node files and patch their Python SONAME
345+ echo "=== Patching Python SONAME in Linux binaries ==="
346+ for file in *.node; do
347+ if [[ -f "$file" && "$file" == *"linux"* ]]; then
348+ echo "Processing $file..."
349+
350+ # Check current dependencies
351+ echo "Current dependencies:"
352+ ldd "$file" 2>/dev/null | grep python || echo "No Python dependencies found"
353+
354+ # Try to patch libpython3.10.so.1.0 -> libpython3.x.so.1.0
355+ PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
356+ echo "Target Python version: $PYTHON_VERSION"
357+
358+ # Use patchelf to replace SONAME
359+ patchelf --replace-needed "libpython3.10.so.1.0" "libpython${PYTHON_VERSION}.so.1.0" "$file" 2>/dev/null || echo "No libpython3.10.so.1.0 to replace"
360+ patchelf --replace-needed "libpython3.11.so.1.0" "libpython${PYTHON_VERSION}.so.1.0" "$file" 2>/dev/null || echo "No libpython3.11.so.1.0 to replace"
361+ patchelf --replace-needed "libpython3.12.so.1.0" "libpython${PYTHON_VERSION}.so.1.0" "$file" 2>/dev/null || echo "No libpython3.12.so.1.0 to replace"
362+
363+ # Check new dependencies
364+ echo "New dependencies:"
365+ ldd "$file" 2>/dev/null | grep python || echo "No Python dependencies found"
366+ echo "---"
367+ fi
368+ done
334369
335370 # Install pnpm and run tests
371+ echo "=== Installing pnpm ==="
336372 corepack disable
337373 npm i -gf pnpm
374+
375+ echo "=== Running tests ==="
338376 pnpm test
339377
340378 publish :
0 commit comments