]> git.donarmstrong.com Git - lilypond.git/commitdiff
(print_environment): move ps_page_count to lilypond-book.py
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 12 Mar 2006 23:28:09 +0000 (23:28 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 12 Mar 2006 23:28:09 +0000 (23:28 +0000)
ChangeLog
python/lilylib.py
scripts/lilypond-book.py

index 915e3051961127465b24994434b1cf45044e99b3..7086ace43089c3c075f51c8a6d972c8cd3a775c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-03-13  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * python/lilylib.py (print_environment): move ps_page_count to lilypond-book.py
+
 2006-03-12  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
        * Documentation/user/music-glossary.tely (G clef): fix clef alignments.
index 9f5d07bba177707d8414941c7ad57c49cfd25db2..23d268f6206dc39cdf4589fad9ea6b036430db04 100644 (file)
@@ -6,11 +6,6 @@
 # (c) 1998--2006 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 #                 Jan Nieuwenhuizen <janneke@gnu.org>
 
-###  subst:\(^\|[^._a-z]\)\(abspath\|identify\|warranty\|progress\|warning\|error\|exit\|getopt_args\|option_help_str\|options_help_str\|help\|setup_temp\|read_pipe\|system\|cleanup_temp\|strip_extension\|cp_to_dir\|mkdir_p\|init\) *(
-###  replace:\1ly.\2 (
-
-### subst: \(help_summary\|keep_temp_dir_p\|option_definitions\|original_dir\|program_name\|pseudo_filter_p\|temp_dir\|verbose_p\)
-
 import __main__
 import glob
 import os
@@ -21,6 +16,13 @@ import sys
 import optparse
 import subprocess
 
+## windows mingw cross compile doesn't have selectmodule.so
+have_select = True
+try:
+       import select
+except ImportError:
+       have_select = False
+       
 ################################################################
 # Users of python modules should include this snippet
 # and customize variables below.
@@ -94,6 +96,9 @@ def system (cmd,
 
        log = ''
 
+       if not have_select:
+               show_progress = True
+
        if show_progress:
                retval = proc.wait()
        else:
@@ -140,13 +145,6 @@ def print_environment ():
                sys.stderr.write ("%s=\"%s\"\n" % (k, v)) 
 
 
-def ps_page_count (ps_name):
-       header = open (ps_name).read (1024)
-       m = re.search ('\n%%Pages: ([0-9]+)', header)
-       if m:
-               return string.atoi (m.group (1))
-       return 0
-
 class NonDentedHeadingFormatter (optparse.IndentedHelpFormatter):
     def format_heading(self, heading):
            if heading:
index 322ce9a39b565f78238115902c46a2c622ff3f8c..f2f48142cd544d9efe6cc2f073012d083fdc5fc5 100644 (file)
@@ -117,6 +117,13 @@ def warning (s):
 def error (s):
        sys.stderr.write (program_name + ": " + _ ("error: %s") % s + '\n')
 
+def ps_page_count (ps_name):
+       header = open (ps_name).read (1024)
+       m = re.search ('\n%%Pages: ([0-9]+)', header)
+       if m:
+               return string.atoi (m.group (1))
+       return 0
+
 def warranty ():
        identify ()
        sys.stdout.write ('''
@@ -1059,7 +1066,7 @@ class Lilypond_snippet (Snippet):
 
                        page_count = 0
                        if ok:
-                               page_count = ly.ps_page_count (base + '.eps')
+                               page_count = ps_page_count (base + '.eps')
                        
                        if page_count == 1:
                                ok = ok and os.path.exists (base + '.png')
@@ -1102,7 +1109,7 @@ class Lilypond_snippet (Snippet):
                   and (not os.path.exists (single) \
                        or (os.stat (multiple)[stat.ST_MTIME] \
                            > os.stat (single)[stat.ST_MTIME])):
-                       count = ly.ps_page_count ('%(base)s.eps' % vars ())
+                       count = ps_page_count ('%(base)s.eps' % vars ())
                        images = ['%s-page%d.png' % (base, a) for a in range (1, count+1)]
                        images = tuple (images)
                return images