]> git.donarmstrong.com Git - lilypond.git/commitdiff
(grob-cause): replace backslashes by /
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 2 Mar 2006 15:33:35 +0000 (15:33 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 2 Mar 2006 15:33:35 +0000 (15:33 +0000)
ChangeLog
python/lilylib.py
scm/output-ps.scm
scripts/lilypond-book.py

index 7c94ad4b98f0c419163fade263f996f205c59df7..33525972932323dd2f601680c7fa1b276783aaf3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-03-02  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/output-ps.scm (grob-cause): replace backslashes by /
+
 2006-03-02  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * cygwin/GNUmakefile: Install fixes.
 
 2006-03-02  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * python/lilylib.py: pychecker cleanups.
+
+       * scripts/lilypond-book.py
+       (Lilypond_snippet.output_print_filename): pychecker cleanups
+
        * scripts/midi2ly.py (Key.dump): pychecker cleanups.
 
        * python/lilylib.py (underscore): remove identify() , warranty()
index d4772286e5e34bc2d821badd9d14e7d393611225..8d51dd57eda071f94f31fb177faeb5a8aec8c4d1 100644 (file)
@@ -18,7 +18,6 @@ import re
 import shutil
 import string
 import sys
-import tempfile
 import optparse
 
 ################################################################
@@ -94,18 +93,6 @@ def lilypond_version_check (binary, req):
                        sys.exit (1)
        
        
-def setup_temp ():
-       
-       ''' Create a temporary directory, and return its name. '''
-       
-       if not __main__.keep_temp_dir_p:
-               __main__.temp_dir = tempfile.mktemp (__main__.program_name)
-       try:
-               os.mkdir (__main__.temp_dir, 0700)
-       except OSError:
-               pass
-
-       return __main__.temp_dir
 
 def command_name (cmd):
        # Strip all stuf after command,
index 0e41c169449efaeff3981c10c7482a162a3b16b7..efc5ad3ca3b35b7270400c5c836b2fb1ea4cf5a2 100644 (file)
                      (ly:number->string (+ (cdr offset) (cdr y-ext)))
 
                      ;; TODO
-                     ;; full escaping.
-                     (string-regexp-substitute " " "%20" file)
+                     ;;full escaping.
+
+                     ;; backslash is interpreted by GS.
+                     (string-regexp-substitute "\\\\" "/" 
+                                     (string-regexp-substitute " " "%20" file))
                      (cadr location)
                      (caddr location)
                      (cadddr location))
index 2d2328672f9f6968b100b07805197a6bbfaea46f..8e9bb407e3d0b2372fadbabdf23fae15641d72ad 100644 (file)
@@ -28,13 +28,10 @@ TODO:
 
 '''
 
-import __main__
-import glob
 import stat
 import string
 import tempfile
 import commands
-import optparse
 import os
 import sys
 import re
@@ -68,9 +65,11 @@ sys.path.insert (0, os.path.join (datadir, 'python'))
 
 # dynamic relocation, for GUB binaries.
 bindir = 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))
+
+
+for prefix_component in ['share', 'lib']:
+       datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % prefix_component)
+       sys.path.insert (0, datadir)
 
 
 import lilylib as ly
@@ -112,7 +111,7 @@ def warranty ():
 %s
 %s
 '''  ( _('Copyright (c) %s by') % '2001--2006',
-       authors
+       authors,
        _('Distributed under terms of the GNU General Public License.'),
        _('It comes with NO WARRANTY.')))
 
@@ -149,8 +148,9 @@ def get_option_parser ():
        p.add_option ('-V', '--verbose', help=_("be verbose"), action="store_true",
                      dest="verbose")
                      
-       p.add_option ('-w', '--warranty', help=_("show warranty and copyright"),
-                     action='store_true'),
+       p.add_option ('-w', '--warranty',
+                     help=_("show warranty and copyright"),
+                     action='store_true')
 
        
        p.add_option_group  ('bugs',
@@ -973,7 +973,7 @@ class Lilypond_snippet (Snippet):
 
                # URGS
                if RELATIVE in override.keys () and override[RELATIVE]:
-                       relative = string.atoi (override[RELATIVE])
+                       relative = int (override[RELATIVE])
 
                relative_quotes = ''
 
@@ -983,8 +983,6 @@ class Lilypond_snippet (Snippet):
                elif relative > 0:
                        relative_quotes += "'" * relative
 
-               program_name = __main__.program_name
-
                paper_string = string.join (compose_dict[PAPER],
                                            '\n  ') % override
                layout_string = string.join (compose_dict[LAYOUT],
@@ -1101,7 +1099,7 @@ class Lilypond_snippet (Snippet):
                        str += self.output_print_filename (HTML)
                        if VERBATIM in self.option_dict:
                                verb = verbatim_html (self.substring ('code'))
-                               str += write (output[HTML][VERBATIM] % vars ())
+                               str += output[HTML][VERBATIM] % vars ()
                        if QUOTE in self.option_dict:
                                str = output[HTML][QUOTE] % vars ()
 
@@ -1387,30 +1385,30 @@ def get_latex_textwidth (source):
        m = re.search (r'''(?P<preamble>\\begin\s*{document})''', source)
        preamble = source[:m.start (0)]
        latex_document = LATEX_INSPECTION_DOCUMENT % vars ()
-       # Workaround problems with unusable $TMP on Cygwin:
-       tempfile.tempdir = ''
-       tmpfile = tempfile.mktemp('.tex')
+       
+       (handle, tmpfile) = tempfile.mkstemp('.tex')
        logfile = os.path.splitext (tmpfile)[0] + '.log'
        open (tmpfile,'w').write (latex_document)
        ly.system ('latex %s' % tmpfile)
        parameter_string = open (logfile).read()
+       
        os.unlink (tmpfile)
        os.unlink (logfile)
 
        columns = 0
        m = re.search ('columns=([0-9.]*)', parameter_string)
        if m:
-               columns = string.atoi (m.group (1))
+               columns = int (m.group (1))
 
        columnsep = 0
        m = re.search ('columnsep=([0-9.]*)pt', parameter_string)
        if m:
-               columnsep = string.atof (m.group (1))
+               columnsep = float (m.group (1))
 
        textwidth = 0
        m = re.search ('textwidth=([0-9.]*)pt', parameter_string)
        if m:
-               textwidth = string.atof (m.group (1))
+               textwidth = float (m.group (1))
                if columns:
                        textwidth = (textwidth - columnsep) / columns
 
@@ -1528,6 +1526,7 @@ def write_if_updated (file_name, lines):
        ly.progress ('\n')
 
 def note_input_file (name, inputs=[]):
+       ## hack: inputs is mutable!
        inputs.append (name)
        return inputs