aboutsummaryrefslogtreecommitdiff
path: root/common/hooks/pre-pkg/05-rename-python3-c-bindings.sh
blob: c16b69d0139f7971e86bfaf4f487b6bfb42deb36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# This hook executes the following tasks:
#	- renames cpython binding files to not include the arch-specific extension suffix

hook() {
	if [ ! -d ${PKGDESTDIR}/${py3_sitelib} ]; then
		return 0
	fi

	find "${PKGDESTDIR}/${py3_sitelib}" -type f -executable -iname '*.cpython*.so' \
		| while read -r file; do
		filename="${file##*/}"
		modulename="${filename%%.*}"
		msg_warn "${pkgver}: renamed '${filename}' to '${modulename}.so'.\n"
		mv ${file} ${file%/*}/${modulename}.so
	done
}