summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2015-09-15 18:28:42 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2015-09-21 10:19:21 +0200
commit228ca4bc6df2024c62b79e55db19d3ad6487cc26 (patch)
treeca79f61f2d218cfe6e7f2f64904a6fcfc7dceaef /scripts/lib
parent5c5b3a22cb7c6f6eb60d5327b83304e6219006bd (diff)
downloadptxdist-228ca4bc6df2024c62b79e55db19d3ad6487cc26.tar.gz
ptxdist-228ca4bc6df2024c62b79e55db19d3ad6487cc26.tar.xz
ptxd_make_world_install: handle python3 pyc files
python3 generates __pycache__/<file>.*.pyc for <file>.py. However, <file>.pyc is needed if <file>.py is not installed. So move the files to meed the requirements. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/ptxd_make_world_install.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/lib/ptxd_make_world_install.sh b/scripts/lib/ptxd_make_world_install.sh
index 9431c160f..09eebd941 100644
--- a/scripts/lib/ptxd_make_world_install.sh
+++ b/scripts/lib/ptxd_make_world_install.sh
@@ -21,6 +21,20 @@ ptxd_make_world_install_prepare() {
}
export -f ptxd_make_world_install_prepare
+ptxd_make_world_install_python_cleanup() {
+ find "${pkg_pkg_dir}" -type d -name bin -prune -o -name "*.py" -print | while read file; do
+ if [ -e "${file}c" -o ! -d "$(dirname "${file}")/__pycache__" ]; then
+ # not python3 or already handled
+ return
+ fi
+ mv -v "$(dirname "${file}")/__pycache__/$(basename "${file%py}")"cpython-??.pyc "${file}c" || return
+ done &&
+ check_pipe_status &&
+ find "${pkg_pkg_dir}" -type d -name __pycache__ -print0 | xargs -0 rm -vrf &&
+ check_pipe_status
+}
+export -f ptxd_make_world_install_python_cleanup
+
#
# FIXME: kick ${pkg_install_env}
#
@@ -60,6 +74,10 @@ ptxd_make_world_install() {
setup.py \
"${pkg_install_opt}" \
)
+ if [ "${pkg_type}" = target ]; then
+ cmd[${#cmd[@]}]='&&'
+ cmd[${#cmd[@]}]=ptxd_make_world_install_python_cleanup
+ fi
;;
*)
cmd=( \