Skip to content

Commit

Permalink
fixup! add error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
avivkeller authored Jun 3, 2024
1 parent 131c997 commit b215e8d
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions android-configure
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
#!/bin/sh

# Run android_configure.py with the latest installed python version (3.6+)
PYTHONS=$(ls /usr/bin | grep -E "^python3(\.[0-9]+)?$" | sort -r)
# Run (current script).py with the latest installed python version (3.6+)

# Find all python3 versions installed in /usr/bin
PYTHONS=$(ls /usr/bin/python3* 2>/dev/null | grep -E "^/usr/bin/python3(\.[0-9]+)?$" | sort -r)

# Check if any python version is found
if [ -z "$PYTHONS" ]; then
echo "No python3 executables found in /usr/bin."
exit 1
fi

# Iterate through each python version
for PYTHON in $PYTHONS; do
# >3.6
if [ `$PYTHON -c "import sys; print(sys.version_info[:2] >= (3, 6))"` = "True" ]; then
$PYTHON android_configure.py $@
# Check if the python version is >= 3.6
if [ "$($PYTHON -c 'import sys; print(sys.version_info >= (3, 6))' 2>/dev/null)" = "True" ]; then
# Run the script with the appropriate python version
$PYTHON "$0.py" "$@"
exit $?
fi
done

echo "No python found with a version >= 3.6"
exit 1

0 comments on commit b215e8d

Please sign in to comment.