]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scripts/midi2ly.py: Fix global syntax warnings.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 3 Nov 2002 14:54:42 +0000 (14:54 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 3 Nov 2002 14:54:42 +0000 (14:54 +0000)
* GNUmakefile.in: Generate builddir locale tree too.

* scripts/ly2dvi.py:
* scripts/midi2ly.py:
* scripts/mup2ly.py:
* scripts/update-lily.py:
* lily/main.cc (setup_paths): Fix for locales setup.

ChangeLog
GNUmakefile.in
lily/main.cc
scripts/lilypond-book.py
scripts/ly2dvi.py
scripts/midi2ly.py
scripts/mup2ly.py
scripts/update-lily.py

index 827f2a62868ca811bac9bf24a887974d132eac83..8734b1f30623db4fd2a916dfd3bae8cd0397e242 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2002-11-03  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * stepmake/stepmake/po-targets.make: Remove --c++ option.
+
+       * scripts/midi2ly.py: Fix global syntax warnings.
+
+       * GNUmakefile.in: Generate builddir locale tree too.
+
+       * scripts/ly2dvi.py:
+       * scripts/midi2ly.py: 
+       * scripts/mup2ly.py: 
+       * scripts/update-lily.py:
+       * lily/main.cc (setup_paths): Fix for locales setup.
+
 2002-10-29  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * Documentation/windows/installing.texi: Soften wording about
index 568118f0a9b600e1fb899e3a166c7bca864209c2..6f0bf75d27fe3d5c47efc9467559e7b0584524f9 100644 (file)
@@ -125,6 +125,10 @@ default: $(config_h) builddir-setup
 
 builddir-setup: $(builddir)/share/lilypond-force
 
+PO_FILES = $(wildcard $(srcdir)/po/*.po)
+HELP_CATALOGS = $(PO_FILES:$(srcdir)/po/%.po=%)
+CATALOGS = $(HELP_CATALOGS:lilypond=) 
+
 $(builddir)/share/lilypond-force:
 # Preparing LilyPond tree for builddir exec
        cd $(builddir) && rm -rf share
@@ -148,6 +152,10 @@ $(builddir)/share/lilypond-force:
                ln -s ../../../mf/$(outconfbase) afm && \
                ln -s ../../../mf/$(outconfbase) tfm && \
                ln -s ../../../mf/$(outconfbase) type1
+       $(foreach i,$(CATALOGS), \
+               mkdir -p $(builddir)/share/locale/$i/LC_MESSAGES && \
+               cd $(builddir)/share/locale/$i/LC_MESSAGES && \
+               ln -fs ../../../../po/$(outconfbase)/$i.mo lilypond.mo &&) true
        touch $@
 
 local-clean: builddir-setup-clean
index dd856b5a810d78b748a851e8fde2f1374409c208..5253bb54f55ea83b6f383f3b8c1fb129d9dbc70d 100644 (file)
@@ -231,23 +231,14 @@ setup_paths ()
     prefix_directory[1] = lilypond_prefix;
 
 #if HAVE_GETTEXT
-  setlocale (LC_ALL, ""); /* enable locales */
-  setlocale (LC_NUMERIC, "C"); /* musn't have comma's in TeX output... */
+  /* Enable locales */
+  setlocale (LC_ALL, "");
+  /* Mustn't have commas in TeX output... */
+  setlocale (LC_NUMERIC, "C");
   String lily_locale_dir;
   String name (PACKAGE);
   name.to_lower ();
-
-  /*
-    urg; what *do* we want with $LILYPONDPREFIX, DIR_DATADIR and $prefix/share
-    handy for multiple source-dir runs, though...
-   */
-  if (!String (prefix_directory[0]).empty_b ())
-    {
-      lily_locale_dir = String (prefix_directory[0]) + "/share/locale";
-      bindtextdomain (name.to_str0 (), lily_locale_dir.to_str0 ());
-    }
-  else
-    bindtextdomain (name.to_str0 (), LOCALEDIR);
+  bindtextdomain (name.to_str0 (), LOCALEDIR);
   textdomain (name.to_str0 ());
 #endif
 
index 68ff22873f5e3424573affb665f68fe8f921347a..cd5b6e5c879501fa68b52644b30f31a815e8cdb5 100644 (file)
@@ -89,7 +89,7 @@ errorport = sys.stderr
 verbose_p = 0
 
 
-
+localedir = '@localedir@'
 try:
        import gettext
        gettext.bindtextdomain ('lilypond', localedir)
index 5f5e0771b41d61d0b08dfca1e1a53e87d810f2a4..3e2e1db95fda42148cc5945f1c6cf1947247b670 100644 (file)
@@ -90,6 +90,7 @@ try:
 except:
        pass
 
+localedir = '@localedir@'
 try:
        import gettext
        gettext.bindtextdomain ('lilypond', localedir)
@@ -249,7 +250,7 @@ def system (cmd, ignore_error = 0, quiet =0):
                name = re.match ('[ \t]*([^ \t]*)', cmd).group (1)
                msg = name + ': ' + _ ("command exited with value %d") % st
                if ignore_error:
-                       if not quiet:
+                       if not quiet or verbose_p:
                                warning (msg + ' ' + _ ("(ignored)") + ' ')
                else:
                        error (msg)
@@ -399,20 +400,6 @@ dependency_files = []
 
 
 
-kpse = os.popen ('kpsexpand \$TEXMF').read()
-kpse = re.sub('[ \t\n]+$','', kpse)
-type1_paths = os.popen ('kpsewhich -expand-path=\$T1FONTS').read ()
-
-environment = {
-       # TODO: * prevent multiple addition.
-       #       * clean TEXINPUTS, MFINPUTS, TFMFONTS,
-       #         as these take prevalence over $TEXMF
-       #         and thus may break tex run?
-       'TEXMF' : "{%s,%s}" % (datadir, kpse) ,
-       'GS_FONTPATH' : type1_paths,
-       'GS_LIB' : datadir + '/ps',
-}
-
 # tex needs lots of memory, more than it gets by default on Debian
 non_path_environment = {
        'extra_mem_top' : '1000000',
@@ -420,7 +407,53 @@ non_path_environment = {
        'pool_size' : '250000',
 }
 
+def command_name (cmd):
+       return re.match ('^[ \t]*([^ \t]*)', cmd).group (1)
+
+def error_log (name):
+       return os.path.join (__main__.temp_dir, '%s.errorlog' % name)
+
+def read_pipe (cmd, mode = 'r'):
+       redirect = ''
+       if verbose_p:
+               progress (_ ("Opening pipe `%s\'") % cmd)
+               redirect = ' 2>%s' % error_log (command_name (cmd))
+       pipe = os.popen (cmd + redirect, mode)
+       output = pipe.read ()
+       status = pipe.close ()
+       # successful pipe close returns 'None'
+       if not status:
+               status = 0
+       signal = 0x0f & status
+       exit_status = status >> 8
+
+       if status:
+               sys.stderr.write (_ ("`%s\' failed (%d)") % (cmd, exit_status))
+               if not verbose_p:
+                       sys.stderr.write (_ ("The error log is as follows:"))
+                       sys.stderr.write (open (error_log (command_name (cmd)).read ()))
+               sys.exit (status)
+       if __main__.verbose_p:
+               progress ('\n')
+       return output
+
 def setup_environment ():
+       global environment
+
+       kpse = read_pipe ('kpsexpand \$TEXMF')
+       texmf = re.sub ('[ \t\n]+$','', kpse)
+       type1_paths = read_pipe ('kpsewhich -expand-path=\$T1FONTS')
+       
+       environment = {
+               # TODO: * prevent multiple addition.
+               #       * clean TEXINPUTS, MFINPUTS, TFMFONTS,
+               #         as these take prevalence over $TEXMF
+               #         and thus may break tex run?
+               'TEXMF' : "{%s,%s}" % (datadir, texmf) ,
+               'GS_FONTPATH' : type1_paths,
+               'GS_LIB' : datadir + '/ps',
+               }
+       
        # $TEXMF is special, previous value is already taken care of
        if os.environ.has_key ('TEXMF'):
                del os.environ['TEXMF']
@@ -1002,8 +1035,8 @@ if files:
        if outdir != '.' and (track_dependencies_p or targets):
                mkdir_p (outdir, 0777)
 
-       setup_environment ()
        tmpdir = setup_temp ()
+       setup_environment ()
 
        # to be sure, add tmpdir *in front* of inclusion path.
        #os.environ['TEXINPUTS'] =  tmpdir + ':' + os.environ['TEXINPUTS']
index 7fe8b24b04157976fa1a429d7f205c7af0318129..a0e431aef45548c37b6f5781e72a741890feb8f2 100644 (file)
@@ -4,8 +4,8 @@
 # 
 # source file of the GNU LilyPond music typesetter
 #
-# convert MIDI to LilyPond source
-#
+# (c) 1998--2002  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+#                 Jan Nieuwenhuizen <janneke@gnu.org>
 
 
 '''
@@ -424,6 +424,7 @@ class Note:
                return (o, n, a)
                
        def dump (self):
+               global reference_note
                s = chr ((self.notename + 2)  % 7 + ord ('a'))
                s = s + self.alteration_names[self.alteration + 2]
                if absolute_p:
@@ -444,10 +445,10 @@ class Note:
                        s = s + "," * -commas
 
                if explicit_durations_p \
-                  or Duration.compare (self.duration, reference_note.duration):
+                  or Duration.compare (self.duration,
+                                       reference_note.duration):
                        s = s + self.duration.dump ()
 
-               global reference_note
                reference_note = self
                
                # TODO: move space
@@ -1045,13 +1046,10 @@ for opt in options:
 
 
        elif o == '--absolute-pitches' or o == '-a':
-               global absolute_p
                absolute_p = 1
        elif o == '--duration-quant' or o == '-d':
-               global duration_quant
                duration_quant = string.atoi (a)
        elif o == '--explicit-durations' or o == '-e':
-               global explicit_durations_p
                explicit_durations_p = 1
        elif o == '--key' or o == '-k':
                (alterations, minor) = map (string.atoi, string.split (a + ':0', ':'))[0:2]
@@ -1061,7 +1059,6 @@ for opt in options:
                        sharps = alterations
                else:
                        flats = - alterations
-               global key
                key = Key (sharps, flats, minor)
        elif o == '--start-quant' or o == '-s':
                start_quant = string.atoi (a)
index da3a43be25ca717202027999b3ce649058871018..88868a8e03f5f13f5c4468add89df1f0bf24fd45 100644 (file)
@@ -55,9 +55,10 @@ errorport = sys.stderr
 keep_temp_dir_p = 0
 verbose_p = 0
 
+localedir = '@localedir@'
 try:
        import gettext
-       gettext.bindtextdomain ('lilypond', '@localedir@')
+       gettext.bindtextdomain ('lilypond', localedir)
        gettext.textdomain ('lilypond')
        _ = gettext.gettext
 except:
index ad34a284abe7bb9b77a743212fbf8313d38f85fc..89b13bc77322da99c0a381de1fc1581586ac7169 100644 (file)
@@ -53,10 +53,10 @@ release_dir = build_root + '/releases'
 patch_dir = build_root + '/patches'
 
 
-
+localedir = '@localedir@'
 try:
        import gettext
-       gettext.bindtextdomain ('lilypond', '@localedir@')
+       gettext.bindtextdomain ('lilypond', localedir)
        gettext.textdomain ('lilypond')
        _ = gettext.gettext
 except: