From eda788a9744b27765a6aaa7cc22a7ca08d66c735 Mon Sep 17 00:00:00 2001 From: John Mandereau Date: Sat, 27 Sep 2008 00:33:15 +0200 Subject: [PATCH] Python scripts: fail explicitly if Python version < 2.4 This is mainly intended for MacOS GUB binaries. --- python/lilylib.py | 8 ++++++++ scripts/convert-ly.py | 2 ++ scripts/lilypond-book.py | 1 + 3 files changed, 11 insertions(+) diff --git a/python/lilylib.py b/python/lilylib.py index f9cbff2c60..15b654f84c 100644 --- a/python/lilylib.py +++ b/python/lilylib.py @@ -68,6 +68,14 @@ def stderr_write (s): progress = stderr_write +def require_python_version (): + if sys.hexversion < 0x02040000: + stderr_write ("Python 2.4 or newer is required to run this program.\n\ +Please upgrade Python from http://python.org/download/, and if you use MacOS X,\n\ +please read installation instructions in Application usage.") + os.system ("open http://python.org/download/") + sys.exit (2) + # Modified version of the commands.mkarg(x), which always uses # double quotes (since Windows can't handle the single quotes: def mkarg(x): diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 9bc0a14005..7affd1bd25 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -21,6 +21,8 @@ import re import lilylib as ly global _;_=ly._ +ly.require_python_version () + import convertrules lilypond_version_re_str = '\\\\version *\"([0-9.]+)"' diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 09fecd1540..be9fef694a 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -45,6 +45,7 @@ import fontextract import langdefs global _;_=ly._ +ly.require_python_version () # Lilylib globals. program_version = '@TOPLEVEL_VERSION@' -- 2.39.5