Skip to content

Commit

Permalink
Fix windows and macos + add input to function (can be used outside)
Browse files Browse the repository at this point in the history
  • Loading branch information
bakpaul committed Jan 10, 2025
1 parent 6fc3a42 commit 7d8be41
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
17 changes: 13 additions & 4 deletions tools/postinstall-fixup/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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_PYTHON3_EXECUTABLE> <SRC_DIR> <INSTALL_DIR> [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)"
Expand Down
2 changes: 1 addition & 1 deletion tools/postinstall-fixup/linux-postinstall-fixup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions tools/postinstall-fixup/macos-postinstall-fixup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -214,6 +214,6 @@ fi


# Generate stubfiles
generate_stubfiles || true
generate_stubfiles "$VM_PYTHON3_EXECUTABLE" "$SRC_DIR" "$INSTALL_DIR" || true

echo "Done."
2 changes: 1 addition & 1 deletion tools/postinstall-fixup/windows-postinstall-fixup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ cd "$INSTALL_DIR" && find -name "*.dll" -path "*/collections/*" | while read lib
done

# Generate stubfiles
generate_stubfiles 1 || true
generate_stubfiles "$VM_PYTHON3_EXECUTABLE" "$SRC_DIR" "$INSTALL_DIR" 1 || true

0 comments on commit 7d8be41

Please sign in to comment.