From 7d8be4132ff150384d6b72cbfe87d04052d5abc2 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Fri, 10 Jan 2025 10:28:47 +0100 Subject: [PATCH] Fix windows and macos + add input to function (can be used outside) --- tools/postinstall-fixup/common.sh | 17 +++++++++++++---- .../linux-postinstall-fixup.sh | 2 +- .../macos-postinstall-fixup.sh | 4 ++-- .../windows-postinstall-fixup.sh | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tools/postinstall-fixup/common.sh b/tools/postinstall-fixup/common.sh index 227554b4fa1..795b666b687 100644 --- a/tools/postinstall-fixup/common.sh +++ b/tools/postinstall-fixup/common.sh @@ -69,17 +69,26 @@ function move_metis() function generate_stubfiles() { - if [ "$#" -eq 0 ]; then - VM_IS_WINDOWS=0 + + if [ "$#" -ge 3 ]; then + VM_PYTHON3_EXECUTABLE="$1" + SRC_DIR="$(cd $2 && pwd)" + INSTALL_DIR="$(cd $3 && pwd)" + if [ "$#" -eq 3 ]; then + VM_IS_WINDOWS=0 + else + VM_IS_WINDOWS=$4 + fi else - VM_IS_WINDOWS=$1 + echo "Usage: generate_stubfiles [VM_IS_WINDOWS = 0]"; exit 1 fi + echo "Generate stubfiles..." if [ -e "$VM_PYTHON3_EXECUTABLE" ]; then export SOFA_ROOT="$INSTALL_DIR" - if $VM_IS_WINDOWS; then + if [ $VM_IS_WINDOWS -ne 0 ]; then pythonroot="$(dirname $VM_PYTHON3_EXECUTABLE)" pythonroot="$(cd "$pythonroot" && pwd)" diff --git a/tools/postinstall-fixup/linux-postinstall-fixup.sh b/tools/postinstall-fixup/linux-postinstall-fixup.sh index 69a985df879..bba21035c69 100644 --- a/tools/postinstall-fixup/linux-postinstall-fixup.sh +++ b/tools/postinstall-fixup/linux-postinstall-fixup.sh @@ -227,6 +227,6 @@ echo "Fixing up libs: done." rm -f postinstall_deps_* # Generate stubfiles -generate_stubfiles || true +generate_stubfiles "$VM_PYTHON3_EXECUTABLE" "$SRC_DIR" "$INSTALL_DIR" || true exit 0 diff --git a/tools/postinstall-fixup/macos-postinstall-fixup.sh b/tools/postinstall-fixup/macos-postinstall-fixup.sh index c4a0526182e..e891d509539 100644 --- a/tools/postinstall-fixup/macos-postinstall-fixup.sh +++ b/tools/postinstall-fixup/macos-postinstall-fixup.sh @@ -7,7 +7,7 @@ usage() { if [ "$#" -ge 1 ]; then SCRIPT_DIR="$(cd $1 && pwd)" - SCRIPT_DIR="$(cd $2 && pwd)" + SRC_DIR="$(cd $2 && pwd)" INSTALL_DIR="$(cd $3 && pwd)" QT_LIB_DIR="$4" QT_DATA_DIR="$5" @@ -214,6 +214,6 @@ fi # Generate stubfiles -generate_stubfiles || true +generate_stubfiles "$VM_PYTHON3_EXECUTABLE" "$SRC_DIR" "$INSTALL_DIR" || true echo "Done." diff --git a/tools/postinstall-fixup/windows-postinstall-fixup.sh b/tools/postinstall-fixup/windows-postinstall-fixup.sh index 2eae3806483..a9d30867000 100644 --- a/tools/postinstall-fixup/windows-postinstall-fixup.sh +++ b/tools/postinstall-fixup/windows-postinstall-fixup.sh @@ -41,4 +41,4 @@ cd "$INSTALL_DIR" && find -name "*.dll" -path "*/collections/*" | while read lib done # Generate stubfiles -generate_stubfiles 1 || true \ No newline at end of file +generate_stubfiles "$VM_PYTHON3_EXECUTABLE" "$SRC_DIR" "$INSTALL_DIR" 1 || true \ No newline at end of file