]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/ly2dvi.py
patch::: 1.4.1.jcn2
[lilypond.git] / scripts / ly2dvi.py
index 9fbb072fef7a7f52a1760cce679670c4790a9a86..d81879fa64e8efee378d0cd5d42cffd2892129b5 100644 (file)
@@ -16,7 +16,8 @@
 
 
 # Note: gettext work best if we use ' for docstrings and "
-# for gettextable strings
+#       for gettextable strings.
+#       --> DO NOT USE """ for docstrings.
 
 '''
 TODO:
@@ -77,9 +78,9 @@ except:
                return s
 
 
-layout_fields = ['title', 'subtitle', 'subsubtitle', 'footer', 'head',
-         'composer', 'arranger', 'instrument', 'opus', 'piece', 'metre',
-         'meter', 'poet']
+layout_fields = ['dedication', 'title', 'subtitle', 'subsubtitle',
+         'footer', 'head', 'composer', 'arranger', 'instrument',
+         'opus', 'piece', 'metre', 'meter', 'poet', 'texttranslator']
 
 
 # init to empty; values here take precedence over values in the file
@@ -135,7 +136,8 @@ if program_version == '@' + 'TOPLEVEL_VERSION' + '@':
 
 
 original_dir = os.getcwd ()
-temp_dir = '%s.dir' % program_name
+temp_dir = os.path.join (original_dir,  '%s.dir' % program_name)
+
 keep_temp_dir_p = 0
 verbose_p = 0
 
@@ -190,7 +192,7 @@ def warning (s):
 def error (s):
 
 
-       """Report the error S.  Exit by raising an exception. Please
+       '''Report the error S.  Exit by raising an exception. Please
        do not abuse by trying to catch this error. If you donn't want
        a stack trace, write to the output directly.
 
@@ -198,7 +200,7 @@ def error (s):
 
        None
        
-       """
+       '''
        
        progress (_ ("error: ") + s)
        raise _ ("Exiting ... ")
@@ -282,7 +284,7 @@ def setup_temp ():
                os.mkdir (temp_dir, 0777)
        except OSError:
                pass
-       
+
        return temp_dir
 
 
@@ -297,6 +299,8 @@ def system (cmd, ignore_error = 0):
         if ( os.name != 'posix' ):
                cmd = re.sub (r'''\\''', r'''\\\\\\''', cmd)
                cmd = "sh -c \'%s\'" % cmd
+
+               
        if verbose_p:
                progress (_ ("Invoking `%s\'") % cmd)
        st = os.system (cmd)
@@ -728,8 +732,15 @@ if files and files[0] != '-':
 
        files = map (lambda x: strip_extension (x, '.ly'), files)
 
+       (outdir, outbase) = ('','')
        if not output_name:
-               output_name = os.path.basename (files[0])
+               outbase = os.path.basename (files[0])
+               outdir = abspath('.')
+       elif output_name[-1] == os.sep:
+               outdir = abspath (output_name)
+               outbase = os.path.basename (files[0])
+       else:
+               (outdir, outbase) = os.path.split (abspath (output_name))
 
        for i in ('.dvi', '.latex', '.ly', '.ps', '.tex'):
                output_name = strip_extension (output_name, i)
@@ -742,8 +753,6 @@ if files and files[0] != '-':
                dep_prefix = 0
 
        reldir = os.path.dirname (output_name)
-       
-       (outdir, outbase) = os.path.split (abspath (output_name))
        if outdir != '.' and (track_dependencies_p or targets.keys ()):
                mkdir_p (outdir, 0777)