]> git.donarmstrong.com Git - lilypond.git/commitdiff
Build: all @macro version -> create-version-itexi.py
authorGraham Percival <graham@percival-music.ca>
Sat, 26 Dec 2009 23:51:32 +0000 (23:51 +0000)
committerGraham Percival <graham@percival-music.ca>
Sun, 27 Dec 2009 00:04:21 +0000 (00:04 +0000)
scripts/build/create-version-itexi.py
stepmake/stepmake/texinfo-rules.make

index 5a64cc66eb1cbbf048d9f521d41a63d490c8db76..a7b14b0c7d5eb4daccb7683f03aa75ae23242f15 100644 (file)
@@ -1,10 +1,15 @@
 #!@PYTHON@
 # create-version-itexi.py
 
+""" when being called on lilypond.org, pass it the location of the
+top source dir on the command-line. """
+
 import sys
 import os
 import glob
 
+
+
 ### just like depth in our GNUmakefiles
 # these links are relative from /~graham/web/
 depth = "../../"
@@ -20,10 +25,14 @@ WEB_DOCLINK_DEVEL  = depth + "doc/v2.13/Documentation/"
 VERSION_STABLE = ""
 VERSION_DEVEL = ""
 
-myDir = os.path.dirname(sys.argv[0])
-# use two abspaths to work around some windows python bug
-topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
-topDir = os.path.abspath( topDir )
+try:
+       topDir = sys.argv[1]
+except:
+       myDir = os.path.dirname(sys.argv[0])
+       # use two abspaths to work around some windows python bug
+       topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
+       topDir = os.path.abspath( topDir )
+
 
 # TODO: this might be useful for other scripts; can we make it available?
 manuals = map(lambda x: os.path.splitext(x)[0],
@@ -36,12 +45,23 @@ manuals.append('internals')
 version_file_path = os.path.join(topDir, "VERSION")
 
 version_contents = open(version_file_path).readlines()
+major = 0
+minor = 0
+patch = 0
 for line in version_contents:
+       if (line[0:13] == 'MAJOR_VERSION'):
+               major = line[14:-1]
+       if (line[0:13] == 'MINOR_VERSION'):
+               minor = line[14:-1]
+       if (line[0:11] == 'PATCH_LEVEL'):
+               patch = line[12:-1]
        if (line[0:14] == 'VERSION_STABLE'):
                VERSION_STABLE = line[15:-1]
        if (line[0:13] == 'VERSION_DEVEL'):
                VERSION_DEVEL = line[14:-1]
 
+VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
+
 def make_macro(name, string):
        print "@macro", name
        print string
@@ -127,6 +147,7 @@ def make_manual_links(name, version):
 
 
 print "@c ************************ Version numbers ************"
+make_macro("version", VERSION)
 make_macro("versionStable", VERSION_STABLE)
 make_macro("versionDevel", VERSION_DEVEL)
 
index b9f379acecb8955da83dc80a5827266da99d84a8..a308aae31e319bcd1d8b1b0f2f131b92592acbf2 100644 (file)
@@ -75,10 +75,6 @@ $(outdir)/%.pdf.omf: %.texi
        $(call GENERATE_OMF,pdf)
 
 $(outdir)/version.%: $(top-src-dir)/VERSION
-       echo '@macro version'> $@
-       echo $(TOPLEVEL_VERSION)>> $@
-       echo '@end macro'>> $@
-       echo ''>> $@
        $(PYTHON) $(top-src-dir)/scripts/build/create-version-itexi.py >> $@
 
 .SECONDARY: $(outdir)/version.itexi $(outdir)/version.texi \