]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
lilypond-book: Pass lilypond version to lilypond-book via env var in makefiles
[lilypond.git] / scripts / lilypond-book.py
index 9998f1ceec367277a181091b4646479e1c3c2af1..d42a77a78760c551d5b5ec76d38766ee35be878b 100644 (file)
@@ -51,6 +51,17 @@ ly.require_python_version ()
 program_version = '@TOPLEVEL_VERSION@'
 program_name = os.path.basename (sys.argv[0])
 
+# Check if program_version contains @ characters. This will be the case if
+# the .py file is called directly while building the lilypond documentation.
+# If so, try to check for the env var LILYPOND_VERSION, which is set by our 
+# makefiles and use its value.
+at_re = re.compile (r'@')
+if at_re.match (program_version):
+    if os.environ.has_key('LILYPOND_VERSION'):
+        program_version = os.environ['LILYPOND_VERSION']
+    else:
+        program_version = "unknown"
+
 original_dir = os.getcwd ()
 backend = 'ps'