-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
131c997
commit b215e8d
Showing
1 changed file
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |