mirror of
https://github.com/openwrt/packages.git
synced 2025-12-22 03:54:34 +04:00
python,python3: handle install script errors better
Depending on execution order the `python-package-install.sh` script would return a non-zero err code. So, this enforces that all commands in the script don't fail (via the `set -e` directive). Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
process_filespec() {
|
process_filespec() {
|
||||||
local src_dir="$1"
|
local src_dir="$1"
|
||||||
@@ -50,10 +51,13 @@ find "$dst_dir" -name "*.egg-info" | xargs rm -rf
|
|||||||
|
|
||||||
if [ "$mode" == "sources" ] ; then
|
if [ "$mode" == "sources" ] ; then
|
||||||
# Copy only python source files
|
# Copy only python source files
|
||||||
find $dst_dir -not -name "*\.py" | xargs rm -f
|
find $dst_dir -type f -not -name "*\.py" | xargs rm -f
|
||||||
|
|
||||||
# Delete empty folders (if the case)
|
# Delete empty folders (if the case)
|
||||||
find $dst_dir/usr -type d | xargs rmdir &> /dev/null
|
if [ -d "$dst_dir/usr" ] ; then
|
||||||
rmdir $dst_dir/usr &> /dev/null
|
find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
|
||||||
|
rmdir --ignore-fail-on-non-empty $dst_dir/usr
|
||||||
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -67,7 +71,15 @@ $python -m compileall -d '/' $dst_dir || {
|
|||||||
echo "python -m compileall err-ed"
|
echo "python -m compileall err-ed"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete source files and pyc [ un-optimized bytecode files ]
|
# Delete source files and pyc [ un-optimized bytecode files ]
|
||||||
# We may want to make this optimization thing configurable later, but not sure atm
|
# We may want to make this optimization thing configurable later, but not sure atm
|
||||||
find $dst_dir -name "*\.py" | xargs rm -f
|
find $dst_dir -type f -name "*\.py" | xargs rm -f
|
||||||
|
|
||||||
|
# Delete empty folders (if the case)
|
||||||
|
if [ -d "$dst_dir/usr" ] ; then
|
||||||
|
find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
|
||||||
|
rmdir --ignore-fail-on-non-empty $dst_dir/usr
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
process_filespec() {
|
process_filespec() {
|
||||||
local src_dir="$1"
|
local src_dir="$1"
|
||||||
@@ -50,10 +51,13 @@ find "$dst_dir" -name "*.egg-info" | xargs rm -rf
|
|||||||
|
|
||||||
if [ "$mode" == "sources" ] ; then
|
if [ "$mode" == "sources" ] ; then
|
||||||
# Copy only python source files
|
# Copy only python source files
|
||||||
find $dst_dir -not -name "*\.py" | xargs rm -f
|
find $dst_dir -type f -not -name "*\.py" | xargs rm -f
|
||||||
|
|
||||||
# Delete empty folders (if the case)
|
# Delete empty folders (if the case)
|
||||||
find $dst_dir/usr -type d | xargs rmdir &> /dev/null
|
if [ -d "$dst_dir/usr" ] ; then
|
||||||
rmdir $dst_dir/usr &> /dev/null
|
find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
|
||||||
|
rmdir --ignore-fail-on-non-empty $dst_dir/usr
|
||||||
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -67,6 +71,15 @@ $python -m compileall -b -d '/' $dst_dir || {
|
|||||||
echo "python -m compileall err-ed"
|
echo "python -m compileall err-ed"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete source files and pyc [ un-optimized bytecode files ]
|
# Delete source files and pyc [ un-optimized bytecode files ]
|
||||||
# We may want to make this optimization thing configurable later, but not sure atm
|
# We may want to make this optimization thing configurable later, but not sure atm
|
||||||
find $dst_dir -name "*\.py" | xargs rm -f
|
find $dst_dir -type f -name "*\.py" | xargs rm -f
|
||||||
|
|
||||||
|
# Delete empty folders (if the case)
|
||||||
|
if [ -d "$dst_dir/usr" ] ; then
|
||||||
|
find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
|
||||||
|
rmdir --ignore-fail-on-non-empty $dst_dir/usr
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user