]> git.donarmstrong.com Git - lilypond.git/commitdiff
Python scripts: fail explicitly if Python version < 2.4
authorJohn Mandereau <john.mandereau@gmail.com>
Fri, 26 Sep 2008 22:33:15 +0000 (00:33 +0200)
committerJohn Mandereau <john.mandereau@gmail.com>
Sun, 28 Sep 2008 23:13:38 +0000 (01:13 +0200)
This is mainly intended for MacOS GUB binaries.

python/lilylib.py
scripts/convert-ly.py
scripts/lilypond-book.py

index f9cbff2c60a84ee84a3ebeb772e6eacc720b9adc..15b654f84c9fcc3bee7efaab98522fb3490c5a2a 100644 (file)
@@ -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):
index 9bc0a1400581d8abae7b461e885d1c2ca9ec4961..7affd1bd255326f44dea783ead14fc295388a49e 100644 (file)
@@ -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.]+)"'
index 09fecd15400b0b348fa05f4ceacfe57d9bf7d219..be9fef694a5d81049d92799b4ecb39d18498fbc9 100644 (file)
@@ -45,6 +45,7 @@ import fontextract
 import langdefs
 global _;_=ly._
 
+ly.require_python_version ()
 
 # Lilylib globals.
 program_version = '@TOPLEVEL_VERSION@'