]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/midi2ly.py
* scm/output-ps.scm (dashed-line): add phase argument to
[lilypond.git] / scripts / midi2ly.py
index a3b53d8fa244d743689cd624511ebd1596ec260d..4a0d956211a3b185a318ecd8c3f5626d4b51ad98 100644 (file)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@TARGET_PYTHON@
 #
 # msdi2ly.py -- LilyPond midi import script
 # 
@@ -25,37 +25,21 @@ import os
 import string
 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/')
-
-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]
-
-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
 
@@ -237,11 +221,11 @@ class Note:
         key = global_options.key
         if key.minor:
             # as -> gis
-            if key.sharps == 0 and key.flats == 0 \
-             and n == 5 and a == -1:
+            if (key.sharps == 0 and key.flats == 0
+                and n == 5 and a == -1):
                 n = 4; a = 1
             # des -> cis
-               elif key.flats == 1 and n == 1 and a == -1:
+            elif key.flats == 1 and n == 1 and a == -1:
                 n = 0; a = 1
             # ges -> fis
             elif key.flats == 2 and n == 4 and a == -1: