]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/etf2ly.py
Improve Python scripts localization
[lilypond.git] / scripts / etf2ly.py
index f2f1489c4f67ed9fd8180408319aff58ea16380c..4e2fcc7a11fb4606a03fe24cc41333c82706135b 100644 (file)
@@ -39,25 +39,9 @@ version = '@TOPLEVEL_VERSION@'
 if version == '@' + 'TOPLEVEL_VERSION' + '@':
     version = '(unknown version)'           # uGUHGUHGHGUGH
 
-
-################################################################
-# Users of python modules should include this snippet.
-#
-
-
-
-
-for d in ['@lilypond_datadir@',
-          '@lilypond_libdir@']:
-    sys.path.insert (0, os.path.join (d, 'python'))
-
-
-# dynamic relocation, for GUB binaries.
-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)
-
+"""
+@relocate-preamble@
+"""
 
 ################################################################
 
@@ -844,7 +828,7 @@ Return: (value, rest-of-STR)
             
         return (string.atoi (dec), str)
     else:
-        sys.stderr.write (cannot convert `%s'\n" % str)
+        sys.stderr.write ("cannot convert `%s'\n" % str)
         return (None, str)
 
 
@@ -1193,21 +1177,28 @@ Copyright (c) %s by
 
 
 def get_option_parser ():
-    p = ly.get_option_parser (usage='etf2ly [OPTIONS]... ETF-FILE',
-                 version="etf2ly (LilyPond) @TOPLEVEL_VERSION@",
-                 description=_("""Enigma Transport Format is a format used by Coda Music Technology's
-Finale product. This program will convert a subset of ETF to a
-ready-to-use LilyPond file."""))
-    p.add_option ('-o', '--output', help=_("write output to FILE"),
+    p = ly.get_option_parser (usage=_ ("%s [OPTION]... ETF-FILE") % 'etf2ly',
+                 description=_ ("""Enigma Transport Format is a format used by Coda Music Technology's
+Finale product.  etf2ly converts a subset of ETF to a ready-to-use LilyPond file."""),
+                 add_help_option=False)
+    p.add_option("-h", "--help",
+                 action="help",
+                 help=_ ("show this help and exit"))
+    p.version = "etf2ly (LilyPond) @TOPLEVEL_VERSION@"
+    p.add_option("--version",
+                 action="version",
+                 help=_ ("show version number and exit"))
+    p.add_option ('-o', '--output', help=_ ("write output to FILE"),
            metavar=_("FILE"),
            action='store')
-    p.add_option ('-w', '--warranty', help=_ ("show warranty"),
+    p.add_option ('-w', '--warranty', help=_ ("show warranty and copyright"),
            action='store_true',
            ),
 
-    p.add_option_group  ('bugs',
-              description='''Report bugs via http://post.gmane.org/post.php'''
-              '''?group=gmane.comp.gnu.lilypond.bugs\n''')
+    p.add_option_group (ly.display_encode (_ ('Bugs')),
+                        description=(_ ('Report bugs via')
+                                     + ''' http://post.gmane.org/post.php'''
+                                     '''?group=gmane.comp.gnu.lilypond.bugs\n'''))
     return p
 
 def do_options ():
@@ -1242,8 +1233,6 @@ for f in files:
     sys.stderr.write ('Writing `%s\'' % out_filename)
     ly = e.dump()
 
-    
-    
     fo = open (out_filename, 'w')
     fo.write ('%% lily was here -- automatically converted by etf2ly from %s\n' % f)
     fo.write(ly)