From 2cbbf3768d48830785cc3e4f95cd8d1b6aac5e82 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 14 Oct 1997 23:04:41 +0000 Subject: [PATCH] lilypond-0.1.23 --- bin/lily-python.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 bin/lily-python.py diff --git a/bin/lily-python.py b/bin/lily-python.py new file mode 100644 index 0000000000..6f85149b50 --- /dev/null +++ b/bin/lily-python.py @@ -0,0 +1,63 @@ +#!@PYTHON@ + +# +# lily-python.py -- implement general LilyPond-wide python stuff +# +# source file of the GNU LilyPond music typesetter +# +# (c) 1997 Han-Wen Nienhuys +# + +import posix +import pwd +import regex +import regsub +import string +import sys +import os +import getopt + + + + + +make_assign_re = regex.compile('^\([A-Z_]*\) *= *\(.*\)$') + +def version_str_tuple(file): + lines = file.readlines() + + mi = pa = mp = mj = '' + + for l in lines: + if make_assign_re.search(l) <> -1: + nm = make_assign_re.group(1) + val = make_assign_re.group(2) + if nm == 'TOPLEVEL_MAJOR_VERSION': + mj = val + elif nm == 'TOPLEVEL_MINOR_VERSION': + mi = val + elif nm == 'TOPLEVEL_PATCH_LEVEL': + pa = val + elif nm == 'TOPLEVEL_MY_PATCH_LEVEL': + mp = val + return (mj,mi,pa,mp) + +class Lilydirs: + def __init__(self): + try: + self.topdir = os.environ['LILYPOND_SOURCEDIR'] + '/' + except IndexError: + self.topdir = os.environ['HOME'] + 'musix/current' + + self.release_dir = self.topdir + '../releases/' + self.patch_dir = self.topdir + '../patches/' + + def version_str_tuple(self): + f = open (self.topdir + 'VERSION') + v = version_str_tuple(f) + f.close () + return v + +lilydirs = Lilydirs() + +print lilydirs.version_str_tuple() -- 2.39.5