]> git.donarmstrong.com Git - lilypond.git/commitdiff
(datadir): remove LILYPONDPREFIX support.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 24 Jul 2006 12:28:53 +0000 (12:28 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 24 Jul 2006 12:28:53 +0000 (12:28 +0000)
ChangeLog
make/lilypond-vars.make
scm/output-lib.scm
scripts/abc2ly.py
scripts/convert-ly.py
scripts/etf2ly.py
scripts/lilypond-book.py
scripts/midi2ly.py
scripts/musicxml2ly.py

index f0d2e72c0ee9ba383096f559f02164f3e9cd8a38..8580df7eaba53aacad32eb91fdda4b3c8c271144 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-24  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * scripts/*.py (program_name): cleanup relocation snippets.
+
+       * scripts/convert-ly.py (datadir): remove LILYPONDPREFIX support.
+
 2006-07-24  Joe Neeman  <joeneeman@gmail.com>
 
        * scm/define-grobs.scm (all-grob-descriptions): make NonMusicalPaperColumn
@@ -28,6 +34,8 @@
 
 2006-07-23  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * VERSION (PACKAGE_NAME): release 2.9.13
+
        * scm/define-grobs.scm (all-grob-descriptions): remove stray
        assignment.
 
 
        * Documentation/topdocs/NEWS.tely (Top): doc new features.
 
-       * scm/output-lib.scm (grace-spacing::calc-shortest-duration): new function.
+       * scm/output-lib.scm (grace-spacing::calc-shortest-duration): new
+       function.
 
        * scm/define-grob-properties.scm (all-user-grob-properties):
        remove grace-space-factor.
 
-       * scm/define-grob-interfaces.scm (grace-spacing-interface): add grace-spacing-interface
-       (spacing-options-interface): add. 
+       * scm/define-grob-interfaces.scm (grace-spacing-interface): add
+       grace-spacing-interface
+       (spacing-options-interface): add.
 
        * ly/engraver-init.ly (AncientRemoveEmptyStaffContext): add Grace_spacing_engraver
 
index 107dd0a5067b12a5cc17b03e24e6a9177f0fd910..fe2920ad1818de5d4e4cb73ebf130df0cc18ad7a 100644 (file)
@@ -1,11 +1,10 @@
 ##
 ## settings to run LilyPond
 ifeq ($(LILYPOND_EXTERNAL_BINARY),)
+
 # environment settings.
 export PATH:=$(top-build-dir)/lily/$(outconfbase):$(top-build-dir)/buildscripts/$(outconfbase):$(top-build-dir)/scripts/$(outconfbase):$(PATH):
-export LILYPONDPREFIX:=$(build_lilypond_datadir)/current
-export DVIPSHEADERS:=$(top-build-dir)/mf/out::
-export LILYPOND_BINARY=$(top-build-dir)/lily/$(outconfbase)/lilypond
+export LILYPOND_BINARY=$(top-build-dir)/$(outconfbase)/bin/lilypond
 else
 
 ## better not take the binaries  from a precompiled bundle, as they
index dd456be80c026322f5bf1b6cfd47904ee97f8072..2496763397fd36deaf92990a186c2e07ecb456bf 100644 (file)
@@ -399,6 +399,6 @@ centered, X==1 is at the right, X == -1 is at the left."
                     (x x)
                     (y y)))))
                     
-        
-    (fold moment-min #f (map get-difference (iota (1- (ly:grob-array-length cols)))))))
+    (fold moment-min #f (map get-difference
+                            (iota (1- (ly:grob-array-length cols)))))))
 
index 6121e51c6a03dbdfec1e5403ca90b701224c9e2a..ba60c1cfeeb447230de77f191f2020c2e31f1576 100644 (file)
@@ -77,25 +77,16 @@ import os
 program_name = sys.argv[0]
 
 
-datadir = '@local_lilypond_datadir@'
-if not os.path.isdir (datadir):
-    datadir = '@lilypond_datadir@'
-
-sys.path.insert (0, os.path.join (datadir, 'python'))
-
-if os.environ.has_key ('LILYPONDPREFIX'):
-    datadir = os.environ['LILYPONDPREFIX']
-    while datadir[-1] == os.sep:
-        datadir= datadir[:-1]
-        
-    datadir = os.path.join (datadir, "share/lilypond/current/")
-sys.path.insert (0, os.path.join (datadir, 'python'))
+for d in ['@lilypond_datadir@',
+          '@lilypond_libdir@']:
+    sys.path.insert (0, os.path.join (d, 'python'))
 
 # dynamic relocation, for GUB binaries.
-bindir = os.path.split (sys.argv[0])[0]
+bindir = os.path.abspath (os.path.split (sys.argv[0])[0])
 for p in ['share', 'lib']:
     datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
-    sys.path.insert (0, os.path.join (datadir))
+    sys.path.insert (0, datadir)
+
 
 import lilylib as ly
 global _;_=ly._
index c4c1e7408252f5861bc375e27e76974ff0f439ea..9c3ebeee831259632f5f265e13c39cb9b9032fd4 100644 (file)
@@ -18,23 +18,15 @@ import re
 
 datadir = '@local_lilypond_datadir@'
 if not os.path.isdir (datadir):
-       datadir = '@lilypond_datadir@'
+    datadir = '@lilypond_datadir@'
 
 sys.path.insert (0, os.path.join (datadir, 'python'))
 
-if os.environ.has_key ('LILYPONDPREFIX'):
-       datadir = os.environ['LILYPONDPREFIX']
-       while datadir[-1] == os.sep:
-               datadir= datadir[:-1]
-               
-       datadir = os.path.join (datadir, "share/lilypond/current/")
-sys.path.insert (0, os.path.join (datadir, 'python'))
-
 # dynamic relocation, for GUB binaries.
-bindir = os.path.split (sys.argv[0])[0]
+bindir = os.path.abspath (os.path.split (sys.argv[0])[0])
 for p in ['share', 'lib']:
-       datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
-       sys.path.insert (0, datadir)
+    datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
+    sys.path.insert (0, datadir)
 
 import lilylib as ly
 global _;_=ly._
@@ -56,7 +48,7 @@ Examples:
 ''')
 
 copyright = ('Jan Nieuwenhuizen <janneke@gnu.org>',
-            'Han-Wen Nienhuys <hanwen@cs.uu.nl>')
+         'Han-Wen Nienhuys <hanwen@cs.uu.nl>')
 
 program_name = os.path.basename (sys.argv[0])
 program_version = '@TOPLEVEL_VERSION@'
@@ -64,17 +56,17 @@ program_version = '@TOPLEVEL_VERSION@'
 add_version = 1
 
 def warning (s):
-       sys.stderr.write (program_name + ": " + _ ("warning: %s") % s + '\n')
+    sys.stderr.write (program_name + ": " + _ ("warning: %s") % s + '\n')
 
 def error (s):
-       sys.stderr.write (program_name + ": " + _ ("error: %s") % s + '\n')
+    sys.stderr.write (program_name + ": " + _ ("error: %s") % s + '\n')
 
 def identify (port=sys.stderr):
-       port.write ('%s (GNU LilyPond) %s\n' % (program_name, program_version))
+    port.write ('%s (GNU LilyPond) %s\n' % (program_name, program_version))
 
 def warranty ():
-       identify ()
-       sys.stdout.write ('''
+    identify ()
+    sys.stdout.write ('''
 Copyright (c) %s by
 
   Han-Wen Nienhuys
@@ -89,212 +81,212 @@ Copyright (c) %s by
 
 
 def get_option_parser ():
-       p = ly.get_option_parser (usage='convert-ly [OPTIONS] FILE',
-                                 version="@TOPLEVEL_VERSION@",
-                                 description=help_summary)
-
-       p.add_option ('-f', '--from', 
-                     action="store",
-                     metavar=_ ("VERSION"),
-                     dest="from_version",
-                     help=_('start from VERSION [default: \\version found in file]'),
-                     default='')
-       
-       p.add_option ('-e', '--edit', help=_('edit in place'),
-                     action='store_true')
-       p.add_option ('-n', '--no-version',
-                     help=_ ('do not add \\version command if missing'),
-                     action='store_true',
-                     dest='skip_version_add',
-                     default=False)
-       
-       p.add_option ("-s", '--show-rules',
-                     help=_('print rules [default: --from=0, --to=@TOPLEVEL_VERSION@]'),
-                     dest='show_rules',
-                     action='store_true', default=False)
-       
-       p.add_option ('-t', '--to',
-                     help=_('convert to VERSION [default: @TOPLEVEL_VERSION@]'),
-                     metavar=_('VERSION'),
-                     action='store',
-                     dest="to_version",
-                     default='')
-
-       p.add_option_group  ('bugs',
-                            description='''Report bugs via http://post.gmane.org/post.php'''
-                            '''?group=gmane.comp.gnu.lilypond.bugs\n''')
-       
-       return p
+    p = ly.get_option_parser (usage='convert-ly [OPTIONS] FILE',
+                  version="@TOPLEVEL_VERSION@",
+                  description=help_summary)
+
+    p.add_option ('-f', '--from', 
+              action="store",
+              metavar=_ ("VERSION"),
+              dest="from_version",
+              help=_('start from VERSION [default: \\version found in file]'),
+              default='')
+    
+    p.add_option ('-e', '--edit', help=_('edit in place'),
+              action='store_true')
+    p.add_option ('-n', '--no-version',
+              help=_ ('do not add \\version command if missing'),
+              action='store_true',
+              dest='skip_version_add',
+              default=False)
+    
+    p.add_option ("-s", '--show-rules',
+              help=_('print rules [default: --from=0, --to=@TOPLEVEL_VERSION@]'),
+              dest='show_rules',
+              action='store_true', default=False)
+    
+    p.add_option ('-t', '--to',
+              help=_('convert to VERSION [default: @TOPLEVEL_VERSION@]'),
+              metavar=_('VERSION'),
+              action='store',
+              dest="to_version",
+              default='')
+
+    p.add_option_group  ('bugs',
+                 description='''Report bugs via http://post.gmane.org/post.php'''
+                 '''?group=gmane.comp.gnu.lilypond.bugs\n''')
+    
+    return p
 
 
 
 def str_to_tuple (s):
-       return tuple (map (int, string.split (s, '.')))
+    return tuple (map (int, string.split (s, '.')))
 
 def tup_to_str (t):
-       return string.join (map (lambda x: '%s' % x, list (t)), '.')
+    return string.join (map (lambda x: '%s' % x, list (t)), '.')
 
 def version_cmp (t1, t2):
-       for x in [0, 1, 2]:
-               if t1[x] - t2[x]:
-                       return t1[x] - t2[x]
-       return 0
+    for x in [0, 1, 2]:
+        if t1[x] - t2[x]:
+            return t1[x] - t2[x]
+    return 0
 
 def get_conversions (from_version, to_version):
-       def is_applicable (v, f = from_version, t = to_version):
-               return version_cmp (v[0], f) > 0 and version_cmp (v[0], t) <= 0
-       return filter (is_applicable, conversions)
+    def is_applicable (v, f = from_version, t = to_version):
+        return version_cmp (v[0], f) > 0 and version_cmp (v[0], t) <= 0
+    return filter (is_applicable, conversions)
 
 def latest_version ():
-       return conversions[-1][0]
+    return conversions[-1][0]
 
 def show_rules (file, from_version, to_version):
-       for x in conversions:
-               if (not from_version or x[0] > from_version) \
-                  and (not to_version or x[0] <= to_version):
-                       file.write  ('%s: %s\n' % (tup_to_str (x[0]), x[2]))
+    for x in conversions:
+        if (not from_version or x[0] > from_version) \
+           and (not to_version or x[0] <= to_version):
+            file.write  ('%s: %s\n' % (tup_to_str (x[0]), x[2]))
 
 def do_conversion (str, from_version, to_version):
-       """Apply conversions from FROM_VERSION to TO_VERSION.  Return
+    """Apply conversions from FROM_VERSION to TO_VERSION.  Return
 tuple (LAST,STR), with the last succesful conversion and the resulting
 string."""
-       conv_list = get_conversions (from_version, to_version)
+    conv_list = get_conversions (from_version, to_version)
 
-       if error_file:
-               error_file.write (_ ("Applying conversion: "))
-               
-       last_conversion = ()
-       try:
-               for x in conv_list:
-                       error_file.write (tup_to_str (x[0]))
-                       if x != conv_list[-1]:
-                               error_file.write (', ')
-                       str = x[1] (str)
-                       last_conversion = x[0]
+    if error_file:
+        error_file.write (_ ("Applying conversion: "))
+        
+    last_conversion = ()
+    try:
+        for x in conv_list:
+            error_file.write (tup_to_str (x[0]))
+            if x != conv_list[-1]:
+                error_file.write (', ')
+            str = x[1] (str)
+            last_conversion = x[0]
 
-       except FatalConversionError:
-               error_file.write (_ ("error while converting")) 
-               error_file.write ('\n')
-               error_file.write (_ ("Aborting"))
-               error_file.write ('\n')
+    except FatalConversionError:
+        error_file.write (_ ("error while converting")) 
+        error_file.write ('\n')
+        error_file.write (_ ("Aborting"))
+        error_file.write ('\n')
 
 
 
-       return (last_conversion, str)
+    return (last_conversion, str)
 
 
 
 def guess_lilypond_version (filename):
-       s = open (filename).read ()
-       m = lilypond_version_re.search (s)
-       if m:
-               return m.group (1)
-       else:
-               return ''
+    s = open (filename).read ()
+    m = lilypond_version_re.search (s)
+    if m:
+        return m.group (1)
+    else:
+        return ''
 
 class FatalConversionError:
-       pass
+    pass
 
 class UnknownVersion:
-       pass
+    pass
 
 def do_one_file (infile_name):
-       sys.stderr.write (_ ("Processing `%s\'... ") % infile_name)
-       sys.stderr.write ('\n')
-
-       from_version = None
-       to_version = None
-       if global_options.from_version:
-               from_version = global_options.from_version
-       else:
-               guess = guess_lilypond_version (infile_name)
-               if not guess:
-                       raise UnknownVersion ()
-               from_version = str_to_tuple (guess)
-
-       if global_options.to_version:
-               to_version = global_options.to_version
-       else:
-               to_version = latest_version ()
-
-
-       if infile_name:
-               infile = open (infile_name, 'r')
-       else:
-               infile = sys.stdin
-
-
-       (last, result) = do_conversion (infile.read (), from_version, to_version)
-       infile.close ()
-
-       if last:
-               newversion = r'\version "%s"' % tup_to_str (last)
-               if lilypond_version_re.search (result):
-                       result = re.sub (lilypond_version_re_str,
-                                        '\\' + newversion, result)
-               elif add_version:
-                       result = newversion + '\n' + result
-                       
-               error_file.write ('\n')                 
-       
-               if global_options.edit:
-                       try:
-                               os.remove(infile_name + '~')
-                       except:
-                               pass
-                       os.rename (infile_name, infile_name + '~')
-                       outfile = open (infile_name, 'w')
-               else:
-                       outfile = sys.stdout
-
-
-               outfile.write (result)
-
-       sys.stderr.flush ()
+    sys.stderr.write (_ ("Processing `%s\'... ") % infile_name)
+    sys.stderr.write ('\n')
+
+    from_version = None
+    to_version = None
+    if global_options.from_version:
+        from_version = global_options.from_version
+    else:
+        guess = guess_lilypond_version (infile_name)
+        if not guess:
+            raise UnknownVersion ()
+        from_version = str_to_tuple (guess)
+
+    if global_options.to_version:
+        to_version = global_options.to_version
+    else:
+        to_version = latest_version ()
+
+
+    if infile_name:
+        infile = open (infile_name, 'r')
+    else:
+        infile = sys.stdin
+
+
+    (last, result) = do_conversion (infile.read (), from_version, to_version)
+    infile.close ()
+
+    if last:
+        newversion = r'\version "%s"' % tup_to_str (last)
+        if lilypond_version_re.search (result):
+            result = re.sub (lilypond_version_re_str,
+                     '\\' + newversion, result)
+        elif add_version:
+            result = newversion + '\n' + result
+            
+        error_file.write ('\n')            
+    
+        if global_options.edit:
+            try:
+                os.remove(infile_name + '~')
+            except:
+                pass
+            os.rename (infile_name, infile_name + '~')
+            outfile = open (infile_name, 'w')
+        else:
+            outfile = sys.stdout
+
+
+        outfile.write (result)
+
+    sys.stderr.flush ()
 
 def do_options ():
-       opt_parser = get_option_parser()
-       (options, args) = opt_parser.parse_args ()
+    opt_parser = get_option_parser()
+    (options, args) = opt_parser.parse_args ()
 
 
-       if options.from_version:
-               options.from_version = str_to_tuple (options.from_version)
-       if options.to_version:
-               options.to_version = str_to_tuple (options.to_version)
+    if options.from_version:
+        options.from_version = str_to_tuple (options.from_version)
+    if options.to_version:
+        options.to_version = str_to_tuple (options.to_version)
 
-       options.outfile_name = ''
-       global global_options
-       global_options = options
+    options.outfile_name = ''
+    global global_options
+    global_options = options
 
-       if not args and not options.show_rules:
-               opt_parser.print_help ()
-               sys.exit (2)
+    if not args and not options.show_rules:
+        opt_parser.print_help ()
+        sys.exit (2)
 
-       return args
+    return args
 
 def main ():
-       files = do_options ()
-
-       # should parse files[] to read \version?
-       if global_options.show_rules:
-               show_rules (sys.stdout, global_options.from_version, global_options.to_version)
-               sys.exit (0)
-
-       identify (sys.stderr)
-
-       for f in files:
-               if f == '-':
-                       f = ''
-               elif not os.path.isfile (f):
-                       error (_ ("can't open file: `%s'") % f)
-                       if len (files) == 1:
-                               sys.exit (1)
-                       continue
-               try:
-                       do_one_file (f)
-               except UnknownVersion:
-                       error (_ ("can't determine version for `%s'. Skipping") % f)
-
-       sys.stderr.write ('\n')
+    files = do_options ()
+
+    # should parse files[] to read \version?
+    if global_options.show_rules:
+        show_rules (sys.stdout, global_options.from_version, global_options.to_version)
+        sys.exit (0)
+
+    identify (sys.stderr)
+
+    for f in files:
+        if f == '-':
+            f = ''
+        elif not os.path.isfile (f):
+            error (_ ("can't open file: `%s'") % f)
+            if len (files) == 1:
+                sys.exit (1)
+            continue
+        try:
+            do_one_file (f)
+        except UnknownVersion:
+            error (_ ("can't determine version for `%s'. Skipping") % f)
+
+    sys.stderr.write ('\n')
 
 main ()
index a5291e92ad94eac4be03ade05c1ee09da3983822..0e85317a2ee9791c25c6d238422f9c54cacab9c8 100644 (file)
@@ -43,32 +43,22 @@ if version == '@' + 'TOPLEVEL_VERSION' + '@':
 ################################################################
 # Users of python modules should include this snippet.
 #
-libdir = '@local_lilypond_libdir@'
-if not os.path.isdir (libdir):
-    libdir = '@lilypond_libdir@'
-
-# ugh
-datadir = '@local_lilypond_datadir@'
-if os.environ.has_key ('LILYPONDPREFIX'):
-    datadir = os.environ['LILYPONDPREFIX']
-    while datadir[-1] == os.sep:
-        datadir= datadir[:-1]
-    libdir = datadir.replace ('/share/', '/lib/')
-
-if os.path.exists (os.path.join (datadir, 'lib/lilypond/@TOPLEVEL_VERSION@/')):
-    libdir = os.path.join (libdir, 'lib/lilypond/@TOPLEVEL_VERSION@/')
-    
-if os.path.exists (os.path.join (datadir, 'lib/lilypond/current/')):
-    libdir = os.path.join (libdir, 'lib/lilypond/current/')
-    
-sys.path.insert (0, os.path.join (libdir, 'python'))
+
+
+
+
+for d in ['@lilypond_datadir@',
+          '@lilypond_libdir@']:
+    sys.path.insert (0, os.path.join (d, 'python'))
+
 
 # dynamic relocation, for GUB binaries.
-bindir = os.path.split (sys.argv[0])[0]
+bindir = os.path.abspath (os.path.split (sys.argv[0])[0])
 for p in ['share', 'lib']:
     datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
     sys.path.insert (0, datadir)
 
+
 ################################################################
 
 import lilylib as ly
index abba494907f16aa8246942c914c1530f29fdf2f8..7861c524a568b6ef30b0497bbd6cdad1e4e17ff7 100644 (file)
@@ -36,40 +36,19 @@ import os
 import sys
 import re
 
-# Users of python modules should include this snippet
-# and customize variables below.
-
-# We'll suffer this path initialization stuff as long as we don't install
-# our python packages in <prefix>/lib/pythonX.Y
-
-# If set, LILYPONDPREFIX must take prevalence.
-# if datadir is not set, we're doing a build and LILYPONDPREFIX.
-
 ################
 # RELOCATION
 ################
 
-datadir = '@local_lilypond_datadir@'
-if not os.path.isdir (datadir):
-    datadir = '@lilypond_datadir@'
-
-sys.path.insert (0, os.path.join (datadir, 'python'))
 
-if os.environ.has_key ('LILYPONDPREFIX'):
-    datadir = os.environ['LILYPONDPREFIX']
-    while datadir[-1] == os.sep:
-        datadir = datadir[:-1]
-
-    if not os.path.exists (os.path.join (datadir, 'python/lilylib.py')):
-        datadir = os.path.join (datadir, 'share/lilypond/current/')
-sys.path.insert (0, os.path.join (datadir, 'python'))
+for d in ['@lilypond_datadir@',
+          '@lilypond_libdir@']:
+    sys.path.insert (0, os.path.join (d, 'python'))
 
 # dynamic relocation, for GUB binaries.
-bindir = os.path.split (sys.argv[0])[0]
-
-
-for prefix_component in ['share', 'lib']:
-    datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % prefix_component)
+bindir = os.path.abspath (os.path.split (sys.argv[0])[0])
+for p in ['share', 'lib']:
+    datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
     sys.path.insert (0, datadir)
 
 
index 256063d6795fdb60a0d6fabd1982c58bcc6686db..e35e9d13eac36119ce0b209a09506cd61b64b29c 100644 (file)
@@ -28,33 +28,20 @@ import sys
 ################################################################
 # Users of python modules should include this snippet.
 #
-libdir = '@local_lilypond_libdir@'
-if not os.path.isdir (libdir):
-    libdir = '@lilypond_libdir@'
 
-# ugh
-datadir = '@local_lilypond_datadir@'
-if os.environ.has_key ('LILYPONDPREFIX'):
-    datadir = os.environ['LILYPONDPREFIX']
-    while datadir[-1] == os.sep:
-        datadir= datadir[:-1]
-    libdir = datadir.replace ('/share/', '/lib/')
+for d in ['@lilypond_datadir@',
+          '@lilypond_libdir@']:
+    sys.path.insert (0, os.path.join (d, 'python'))
 
-if os.path.exists (os.path.join (datadir, 'lib/lilypond/@TOPLEVEL_VERSION@/')):
-    libdir = os.path.join (libdir, 'lib/lilypond/@TOPLEVEL_VERSION@/')
-
-if os.path.exists (os.path.join (datadir, 'lib/lilypond/current/')):
-    libdir = os.path.join (libdir, 'lib/lilypond/current/')
-
-sys.path.insert (0, os.path.join (libdir, 'python'))
+sys.path.insert (0, os.path.join (datadir, 'python'))
 
 # dynamic relocation, for GUB binaries.
-bindir = os.path.split (sys.argv[0])[0]
-
-for prefix_component in ['share', 'lib']:
-    datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % prefix_component)
+bindir = os.path.abspath (os.path.split (sys.argv[0])[0])
+for p in ['share', 'lib']:
+    datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
     sys.path.insert (0, datadir)
 
+
 import midi
 import lilylib as ly
 
index 5f25567c592909beb52fca77bedffcb433fd9cbc..f3fd9a7a06131cb467fe4d95f274acdebb3f49af 100644 (file)
@@ -9,30 +9,19 @@ from gettext import gettext as _
 
 
 
-
-datadir = '@local_lilypond_datadir@'
-if not os.path.isdir (datadir):
-    datadir = '@lilypond_datadir@'
-if os.environ.has_key ('LILYPONDPREFIX'):
-    datadir = os.environ['LILYPONDPREFIX']
-    while datadir[-1] == os.sep:
-        datadir = datadir[:-1]
-
-if os.path.exists (os.path.join (datadir, 'share/lilypond/@TOPLEVEL_VERSION@/')):
-    datadir = os.path.join (datadir, 'share/lilypond/@TOPLEVEL_VERSION@/')
-elif os.path.exists (os.path.join (datadir, 'share/lilypond/current/')):
-    datadir = os.path.join (datadir, 'share/lilypond/current/')
-
-sys.path.insert (0, os.path.join (datadir, 'python'))
+for d in ['@lilypond_datadir@',
+          '@lilypond_libdir@']:
+    sys.path.insert (0, os.path.join (d, 'python'))
 
 # dynamic relocation, for GUB binaries.
-bindir = os.path.split (sys.argv[0])[0]
-
-for prefix_component in ['share', 'lib']:
-    datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % prefix_component)
+bindir = os.path.abspath (os.path.split (sys.argv[0])[0])
+for p in ['share', 'lib']:
+    datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
     sys.path.insert (0, datadir)
 
 
+
+
 import lilylib as ly
 
 import musicxml