Skip to content

Commit c4407fc

Browse files
committed
scripts/python-framework.sh: Use pkgutil to unpack the pkg
1 parent 99bf424 commit c4407fc

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scripts/macos/python-framework.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,22 @@ python-framework-fetch-pkg() {
8080
python-framework-extract-pkg() {
8181
local targetdir=${1:?}
8282
local pkgpath=${2:?}
83+
local pkgfilename
84+
pkgfilename=$(basename "${pkgpath}")
8385
mkdir -p "${targetdir}"/Python.framework
8486
verbose 1 "Extracting framework at ${targetdir}/Python.framework"
85-
tar -O -xf "${pkgpath}" Python_Framework.pkg/Payload | \
86-
tar -x -C "${targetdir}"/Python.framework
87+
(
88+
tmpdir=$(mktemp -d -t python-framework-extract-pkg)
89+
cleanup-on-exit() {
90+
if [ -d "${tmpdir:?}" ] ; then
91+
rm -rf "${tmpdir:?}"
92+
fi
93+
}
94+
trap cleanup-on-exit EXIT
95+
pkgutil --expand "${pkgpath}" "${tmpdir:?}/${pkgfilename}" || exit 1
96+
tar -C "${targetdir}"/Python.framework \
97+
-xf "${tmpdir}/${pkgfilename}/Python_Framework.pkg/Payload" || exit 1
98+
)
8799
}
88100

89101

0 commit comments

Comments
 (0)