mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: name the old Python the bootstrap found
This commit is contained in:
1 parent
3389651549
commit
9aa26143ad
2 files changed
+31
-2
No files matched your search
+19
-2
@@ -127,10 +127,18 @@ fi
|
||||
find_python() {
|
||||
PYTHON=""
|
||||
PYTHON_LACKING=""
|
||||
PYTHON_OLD=""
|
||||
for command_name in python3 python; do
|
||||
command -v "$command_name" >/dev/null 2>&1 || continue
|
||||
"$command_name" -c 'import sys; raise SystemExit(sys.version_info < (3, 8))' \
|
||||
2>/dev/null || continue
|
||||
if ! "$command_name" -c 'import sys; raise SystemExit(sys.version_info < (3, 8))' \
|
||||
2>/dev/null; then
|
||||
found_version=$("$command_name" -c \
|
||||
'import sys; print("%d.%d.%d" % tuple(sys.version_info[:3]))' 2>/dev/null)
|
||||
if [ -n "$found_version" ]; then
|
||||
PYTHON_OLD=${PYTHON_OLD:-"$command_name here is $found_version"}
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
if "$command_name" -c 'import ssl, unicodedata, zlib' 2>/dev/null; then
|
||||
PYTHON=$command_name
|
||||
return 0
|
||||
@@ -184,6 +192,15 @@ if [ -z "$PYTHON" ] && [ -n "$PYTHON_LACKING" ]; then
|
||||
echo " (ssl, unicodedata or zlib). Run it with a full Python 3.8 or newer." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$PYTHON" ] && [ -n "$PYTHON_OLD" ]; then
|
||||
# Debian Buster ships 3.7: apt answers that python3 is already the newest
|
||||
# version, and the same advice looped.
|
||||
echo "Error: Python 3.8 or newer is required, and $PYTHON_OLD." >&2
|
||||
echo " Install a newer one: from this system's packages if they offer one, by" >&2
|
||||
echo " updating the system, or from https://www.python.org/downloads/." >&2
|
||||
echo " Then run this command again." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$PYTHON" ]; then
|
||||
echo "Error: Python 3.8 or newer is required." >&2
|
||||
if [ -n "$install_command" ]; then
|
||||
|
||||
@@ -2628,6 +2628,18 @@ class ABootstrapPythonCanDoHttps(unittest.TestCase):
|
||||
self.assertEqual(proc.returncode, 0, proc.stderr)
|
||||
self.assertIn("installer ran", proc.stdout)
|
||||
|
||||
def test_an_old_python_is_named_with_its_version(self):
|
||||
"""Debian Buster's python3 3.7 got "Install it with: sudo apt install
|
||||
python3", which apt answers with "already the newest version"."""
|
||||
root, fake_bin = self._bin()
|
||||
(fake_bin / "python3").write_text(
|
||||
'#!/bin/sh\ncase "$2" in *print*) echo 3.7.3 ;; esac\nexit 1\n')
|
||||
proc = self._run(root, fake_bin)
|
||||
self.assertEqual(proc.returncode, 1)
|
||||
self.assertIn("Python 3.8 or newer is required, and python3 here is 3.7.3.",
|
||||
proc.stderr)
|
||||
self.assertNotIn("Install it with: sudo apt", proc.stderr)
|
||||
|
||||
def test_the_missing_module_is_named(self):
|
||||
root, fake_bin = self._bin()
|
||||
proc = self._run(root, fake_bin)
|
||||
|
||||
Reference in new issue
Block a user