]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/lilylib.py
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / python / lilylib.py
index e902feb13404926dc2ea83cc81e0c1d15e210671..156c9b7c8da95e21516f0775685ccff32f0fa242 100644 (file)
@@ -24,14 +24,14 @@ import optparse
 # it as we do with teTeX on Red Hat Linux: set some environment var
 # (PYTHONPATH) in profile)
 
-# If set, LILYPONDPREFIX must take prevalence
-# if datadir is not set, we're doing a build and LILYPONDPREFIX
+# If set, LILYPOND_DATADIR must take prevalence
+# if datadir is not set, we're doing a build and LILYPOND_DATADIR
 
 datadir = '@local_lilypond_datadir@'
 if not os.path.isdir (datadir):
     datadir = '@lilypond_datadir@'
-if os.environ.has_key ('LILYPONDPREFIX') :
-    datadir = os.environ['LILYPONDPREFIX']
+if os.environ.has_key ('LILYPOND_DATADIR') :
+    datadir = os.environ['LILYPOND_DATADIR']
     while datadir[-1] == os.sep:
        datadir= datadir[:-1]
 
@@ -123,10 +123,41 @@ def subprocess_system (cmd,
 
     return abs (retval)
 
+def ossystem_system (cmd,
+                     ignore_error=False,
+                     progress_p=True,
+                     be_verbose=False,
+                     log_file=None):
+
+
+    name = command_name (cmd)
+    if be_verbose:
+       show_progress = 1
+       progress (_ ("Invoking `%s\'") % cmd)
+    else:
+       progress ( _("Running %s...") % name)
+
+    retval = os.system (cmd)
+    if retval:
+       print >>sys.stderr, 'command failed:', cmd
+       if retval < 0:
+           print >>sys.stderr, "Child was terminated by signal", -retval
+       elif retval > 0:
+           print >>sys.stderr, "Child returned", retval
+
+       if ignore_error:
+           print >>sys.stderr, "Error ignored"
+       else:
+           sys.exit (1)
+
+    return abs (retval)
 
 
 system = subprocess_system
+if sys.platform == 'mingw32':
     
+    ## subprocess x-compile doesn't work.
+    system = ossystem_system
 
 def strip_extension (f, ext):
     (p, e) = os.path.splitext (f)
@@ -169,7 +200,7 @@ class NonDentedHeadingFormatter (optparse.IndentedHelpFormatter):
                               metavar)
 
     def format_usage(self, usage):
-        return _("Usage: %s\n") % usage
+        return _("Usage: %s") % usage + '\n'
 
     def format_description(self, description):
        return description