macos-setup.sh: fix Python 3 installation for OS X 10.8 and older
authorPeter Wu <peter@lekensteyn.nl>
Thu, 8 Nov 2018 16:39:53 +0000 (17:39 +0100)
committerGerald Combs <gerald@wireshark.org>
Thu, 8 Nov 2018 17:26:03 +0000 (17:26 +0000)
Change-Id: I3c5b7fa272fbef770b06430edadb8abfc688e951
Fixes: v2.9.0rc0-2460-ge9f7bb5127 ("Require Python 3, drop Python 2 support")
Reviewed-on: https://code.wireshark.org/review/30548
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
tools/macos-setup.sh

index 4b5864ded2a72374a6d550ac5f162e6e2932e696..7cce6388e1428c0cfc08ebf8b4c4cfa5eccc359f 100755 (executable)
@@ -1702,11 +1702,17 @@ uninstall_json_glib() {
 }
 
 install_python3() {
+    local macver=10.9
+    if [[ $DARWIN_MAJOR_VERSION -lt 13 ]]; then
+        # The 64-bit installer requires 10.9 (Mavericks), use the 64-bit/32-bit
+        # variant for 10.6 (Snow Leopard) and newer.
+        macver=10.6
+    fi
     if [ "$PYTHON3_VERSION" -a ! -f python3-$PYTHON3_VERSION-done ] ; then
         echo "Downloading and installing python3:"
-        [ -f python-$PYTHON3_VERSION-macosx10.9.pkg ] || curl -L -O https://www.python.org/ftp/python/$PYTHON3_VERSION/python-$PYTHON3_VERSION-macosx10.9.pkg || exit 1
+        [ -f python-$PYTHON3_VERSION-macosx$macver.pkg ] || curl -L -O https://www.python.org/ftp/python/$PYTHON3_VERSION/python-$PYTHON3_VERSION-macosx$macver.pkg || exit 1
         $no_build && echo "Skipping installation" && return
-        sudo installer -target / -pkg python-$PYTHON3_VERSION-macosx10.9.pkg || exit 1
+        sudo installer -target / -pkg python-$PYTHON3_VERSION-macosx$macver.pkg || exit 1
         touch python3-$PYTHON3_VERSION-done
     fi
 }
@@ -1738,6 +1744,7 @@ uninstall_python3() {
             # Get rid of the previously downloaded and unpacked version.
             #
             rm -f python-$installed_python3_version-macosx10.9.pkg
+            rm -f python-$installed_python3_version-macosx10.6.pkg
         fi
 
         installed_python3_version=""