3 # Run lilypond, latex, dvips.
5 # This is the third incarnation of ly2dvi.
7 # Earlier incarnations of ly2dvi were written by
8 # Jeffrey B. Reed<daboys@austin.rr.com> (Python version)
9 # Jan Arne Fagertun <Jan.A.Fagertun@@energy.sintef.no> (Bourne shell script)
13 # Note: gettext work best if we use ' for docstrings and "
14 # for gettextable strings.
15 # --> DO NOT USE """ for docstrings.
20 * figure out which set of command line options should make ly2dvi:
23 na: create latex only?
24 na: create tex and latex
25 default: create dvi only
26 na: create tex, latex and dvi
32 for foo.ly, rename ly2dvi.dir to out-ly2dvi, foo.ly2dvi, foo.dir ?
34 * move versatile taglines,
37 beginfooter=\mutopiaPD
38 endfooter=\tagline -> 'lily was here <version>'
41 lilytagline (->lily was here), usertagline, copyright etc.
43 * head/header tagline/endfooter
45 * dvi from lilypond .tex output? This is hairy, because we create dvi
46 from lilypond .tex *and* header output.
48 * multiple \score blocks?
66 ################################################################
67 # lilylib.py -- options and stuff
69 # source file of the GNU LilyPond music typesetter
71 # Handle bug in Python 1.6-2.1
73 # there are recursion limits for some patterns in Python 1.6 til 2.1.
74 # fix this by importing pre instead. Fix by Mats.
76 # todo: should check Python version first.
84 # Attempt to fix problems with limited stack size set by Python!
85 # Sets unlimited stack size. Note that the resource module only
86 # is available on UNIX.
89 resource.setrlimit (resource.RLIMIT_STACK, (-1, -1))
95 gettext.bindtextdomain ('lilypond', localedir)
96 gettext.textdomain ('lilypond')
102 program_version = '@TOPLEVEL_VERSION@'
103 if program_version == '@' + 'TOPLEVEL_VERSION' + '@':
104 program_version = '1.5.54'
107 sys.stdout.write ('%s (GNU LilyPond) %s\n' % (program_name, program_version))
111 sys.stdout.write ('\n')
112 sys.stdout.write (_ ('Copyright (c) %s by' % ' 2001--2002'))
113 sys.stdout.write ('\n')
114 sys.stdout.write (' Han-Wen Nienhuys')
115 sys.stdout.write (' Jan Nieuwenhuizen')
116 sys.stdout.write ('\n')
117 sys.stdout.write (_ (r'''
118 Distributed under terms of the GNU General Public License. It comes with
120 sys.stdout.write ('\n')
123 errorport.write (s + '\n')
126 progress (_ ("warning: ") + s)
128 def user_error (s, e=1):
129 errorport.write (program_name + ":" + _ ("error: ") + s + '\n')
133 '''Report the error S. Exit by raising an exception. Please
134 do not abuse by trying to catch this error. If you do not want
135 a stack trace, write to the output directly.
143 progress (_ ("error: ") + s)
144 raise _ ("Exiting ... ")
146 def getopt_args (opts):
147 '''Construct arguments (LONG, SHORT) for getopt from list of options.'''
162 def option_help_str (o):
163 '''Transform one option description (4-tuple ) into neatly formatted string'''
181 return ' ' + sh + sep + long + arg
184 def options_help_str (opts):
185 '''Convert a list of options into a neatly formatted string'''
191 s = option_help_str (o)
192 strs.append ((s, o[3]))
198 str = str + '%s%s%s\n' % (s[0], ' ' * (w - len(s[0]) + 3), s[1])
202 ls = [(_ ("Usage: %s [OPTION]... FILE") % program_name),
208 (options_help_str (option_definitions)),
210 (_ ("Report bugs to %s") % 'bug-lilypond@gnu.org'),
212 map (sys.stdout.write, ls)
216 Create a temporary directory, and return its name.
219 if not keep_temp_dir_p:
220 temp_dir = tempfile.mktemp (program_name)
222 os.mkdir (temp_dir, 0777)
229 def system (cmd, ignore_error = 0, quiet =0):
230 """Run CMD. If IGNORE_ERROR is set, don't complain when CMD returns non zero.
238 progress (_ ("Invoking `%s\'") % cmd)
242 name = re.match ('[ \t]*([^ \t]*)', cmd).group (1)
243 msg = name + ': ' + _ ("command exited with value %d") % st
246 warning (msg + ' ' + _ ("(ignored)") + ' ')
254 if not keep_temp_dir_p:
256 progress (_ ("Cleaning %s...") % temp_dir)
257 shutil.rmtree (temp_dir)
260 def strip_extension (f, ext):
261 (p, e) = os.path.splitext (f)
267 def cp_to_dir (pattern, dir):
268 "Copy files matching re PATTERN from cwd to DIR"
269 # Duh. Python style portable: cp *.EXT OUTDIR
270 # system ('cp *.%s %s' % (ext, outdir), 1)
271 files = filter (lambda x, p=pattern: re.match (p, x), os.listdir ('.'))
272 map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files)
275 # Python < 1.5.2 compatibility
277 # On most platforms, this is equivalent to
278 #`normpath(join(os.getcwd()), PATH)'. *Added in Python version 1.5.2*
279 if os.path.__dict__.has_key ('abspath'):
280 abspath = os.path.abspath
283 return os.path.normpath (os.path.join (os.getcwd (), path))
285 if os.__dict__.has_key ('makedirs'):
286 makedirs = os.makedirs
288 def makedirs (dir, mode=0777):
289 system ('mkdir -p %s' % dir)
292 def mkdir_p (dir, mode=0777):
293 if not os.path.isdir (dir):
297 # if set, LILYPONDPREFIX must take prevalence
298 # if datadir is not set, we're doing a build and LILYPONDPREFIX
299 datadir = '@local_lilypond_datadir@'
301 if os.environ.has_key ('LILYPONDPREFIX') :
302 datadir = os.environ['LILYPONDPREFIX']
304 datadir = '@local_lilypond_datadir@'
307 while datadir[-1] == os.sep:
308 datadir= datadir[:-1]
310 sys.path.insert (0, os.path.join (datadir, 'python'))
312 ################################################################
316 program_name = 'ly2dvi'
318 original_dir = os.getcwd ()
319 temp_dir = os.path.join (original_dir, '%s.dir' % program_name)
320 errorport = sys.stderr
324 preview_resolution = 90
326 help_summary = _ ("Generate .dvi with LaTeX for LilyPond")
328 option_definitions = [
329 ('', 'd', 'dependencies', _ ("write Makefile dependencies for every input file")),
330 ('', 'h', 'help', _ ("this help")),
331 (_ ("DIR"), 'I', 'include', _ ("add DIR to LilyPond's search path")),
332 ('', 'k', 'keep', _ ("keep all output, and name the directory %s.dir") % program_name),
333 ('', '', 'no-lily', _ ("don't run LilyPond")),
334 ('', 'm', 'no-paper', _ ("produce MIDI output only")),
335 (_ ("FILE"), 'o', 'output', _ ("write ouput to FILE")),
336 (_ ("FILE"), 'f', 'find-pfa', _ ("find pfa fonts used in FILE")),
338 ('', '', 'preview', _("Make a picture of the first system.")),
339 (_ ('RES'), '', 'preview-resolution', _("Set the resolution of the preview to RES.")),
340 ('', 'P', 'postscript', _ ("generate PostScript output")),
341 (_ ("KEY=VAL"), 's', 'set', _ ("change global setting KEY to VAL")),
342 ('', 'V', 'verbose', _ ("verbose")),
343 ('', 'v', 'version', _ ("print version number")),
344 ('', 'w', 'warranty', _ ("show warranty and copyright")),
347 layout_fields = ['dedication', 'title', 'subtitle', 'subsubtitle',
348 'footer', 'head', 'composer', 'arranger', 'instrument',
349 'opus', 'piece', 'metre', 'meter', 'poet', 'texttranslator']
352 # init to empty; values here take precedence over values in the file
354 ## TODO: change name.
358 'latexpackages' : ['geometry'],
368 extra_fields = extra_init.keys ()
369 fields = layout_fields + extra_fields
377 ## docme: what does this do?
378 targets = [ 'DVI', 'LATEX', 'MIDI', 'TEX']
380 track_dependencies_p = 0
381 dependency_files = []
385 kpse = os.popen ('kpsexpand \$TEXMF').read()
386 kpse = re.sub('[ \t\n]+$','', kpse)
387 type1_paths = os.popen ('kpsewhich -expand-path=\$T1FONTS').read ()
390 # TODO: * prevent multiple addition.
391 # * clean TEXINPUTS, MFINPUTS, TFMFONTS,
392 # as these take prevalence over $TEXMF
393 # and thus may break tex run?
394 'TEXMF' : "{%s,%s}" % (datadir, kpse) ,
395 'GS_FONTPATH' : type1_paths,
396 'GS_LIB' : datadir + '/ps',
399 # tex needs lots of memory, more than it gets by default on Debian
400 non_path_environment = {
401 'extra_mem_top' : '1000000',
402 'extra_mem_bottom' : '1000000',
403 'pool_size' : '250000',
406 def setup_environment ():
407 # $TEXMF is special, previous value is already taken care of
408 if os.environ.has_key ('TEXMF'):
409 del os.environ['TEXMF']
411 for key in environment.keys ():
412 val = environment[key]
413 if os.environ.has_key (key):
414 val = os.environ[key] + os.pathsep + val
415 os.environ[key] = val
417 for key in non_path_environment.keys ():
418 val = non_path_environment[key]
419 os.environ[key] = val
422 def set_setting (dict, key, val):
424 val = string.atof (val)
426 #warning (_ ("invalid value: %s") % `val`)
430 dict[key].append (val)
432 warning (_ ("no such setting: %s") % `key`)
436 def print_environment ():
437 for (k,v) in os.environ.items ():
438 sys.stderr.write ("%s=\"%s\"\n" % (k,v))
440 def quiet_system (cmd, name, ignore_error = 0):
442 progress ( _("Running %s...") % name)
443 cmd = cmd + ' 1> /dev/null 2> /dev/null'
445 return system (cmd, ignore_error, quiet = 1)
448 def run_lilypond (files, outbase, dep_prefix):
450 # opts = opts + '--output=%s.tex' % outbase
451 opts = opts + ' ' + string.join (map (lambda x : '-I ' + x,
454 opts = opts + ' ' + string.join (map (lambda x : '-H ' + x,
457 opts = opts + ' --no-paper'
459 if track_dependencies_p:
460 opts = opts + " --dependencies"
462 opts = opts + ' --dep-prefix=%s' % dep_prefix
464 fs = string.join (files)
467 # cmd = cmd + ' 1> /dev/null 2> /dev/null'
468 progress ( _("Running %s...") % 'LilyPond')
470 opts = opts + ' --verbose'
472 # for better debugging!
475 cmd = 'lilypond %s %s ' % (opts, fs)
477 progress ("Invoking `%s'"% cmd)
478 status = os.system (cmd)
480 signal = 0x0f & status
481 exit_status = status >> 8
483 # 2 == user interrupt.
484 if signal and signal <> 2:
485 error("\n\nLilyPond crashed (signal %d). Please submit a bugreport to bug-lilypond@gnu.org\n" % signal)
488 error ("\n\nLilyPond failed on the input file. (exit status %d)\n" % exit_status)
491 def analyse_lilypond_output (filename, extra):
494 '''Grep FILENAME for interesting stuff, and
495 put relevant info into EXTRA.'''
496 filename = filename+'.tex'
497 progress (_ ("Analyzing %s...") % filename)
498 s = open (filename).read ()
500 # search only the first 10k
502 for x in extra_fields:
503 m = re.search (r'\\def\\lilypondpaper%s{([^}]*)}'%x, s)
505 set_setting (extra, x, m.group (1))
507 def find_tex_files_for_base (base, extra):
510 Find the \header fields dumped from BASE.
514 for f in layout_fields:
515 if os.path.exists (base + '.' + f):
516 headerfiles[f] = base+'.'+f
518 if os.path.exists (base +'.dep'):
519 dependency_files.append (base + '.dep')
521 for f in extra_fields:
522 if os.path.exists (base + '.' + f):
523 extra[f].append (open (base + '.' + f).read ())
525 return (base +'.tex',headerfiles)
528 def find_tex_files (files, extra):
530 Find all .tex files whose prefixes start with some name in FILES.
539 fname = os.path.basename (f)
540 fname = strip_extension (fname, '.ly')
542 fname = fname + '-%d' % x
544 if os.path.exists (fname + '.tex'):
545 tfiles.append (find_tex_files_for_base (fname, extra))
546 analyse_lilypond_output (fname, extra)
552 fstr = string.join (files, ', ')
553 warning (_ ("no lilypond output found for %s") % fstr)
556 def one_latex_definition (defn, first):
558 for (k,v) in defn[1].items ():
559 val = open (v).read ()
560 if (string.strip (val)):
561 s = s + r'''\def\lilypond%s{%s}''' % (k, val)
563 s = s + r'''\let\lilypond%s\relax''' % k
567 s = s + '\\def\\mustmakelilypondtitle{}\n'
569 s = s + '\\def\\mustmakelilypondpiecetitle{}\n'
571 s = s + '\\input %s\n' % defn[0] # The final \n seems important here. It ensures that the footers and taglines end up on the right page.
575 ly_paper_to_latexpaper = {
577 'letter' : 'letterpaper',
580 #TODO: should set textheight (enlarge) depending on papersize.
581 def global_latex_preamble (extra):
582 '''construct preamble from EXTRA,'''
584 s = s + '% generation tag\n'
589 if extra['papersize']:
591 options = ly_paper_to_latexpaper[extra['papersize'][0]]
593 warning (_ ("invalid value: %s") % `extra['papersize'][0]`)
596 if extra['latexoptions']:
597 options = options + ',' + extra['latexoptions'][-1]
599 s = s + '\\documentclass[%s]{article}\n' % options
601 if extra['language']:
602 s = s + r'\usepackage[%s]{babel}' % extra['language'][-1] + '\n'
605 s = s + '\\usepackage{%s}\n' \
606 % string.join (extra['latexpackages'], ',')
608 if extra['latexheaders']:
609 s = s + '\\include{%s}\n' \
610 % string.join (extra['latexheaders'], '}\n\\include{')
612 unit = extra['unit'][-1]
615 if extra['textheight']:
616 textheight = ',textheight=%f%s' % (extra['textheight'][0], unit)
618 orientation = 'portrait'
619 if extra['orientation']:
620 orientation = extra['orientation'][0]
622 # set sane geometry width (a4-width) for linewidth = -1.
623 maxlw = max (extra['linewidth'] + [-1])
625 # who the hell is 597 ?
628 linewidth = '%d%s' % (maxlw, unit)
629 s = s + '\geometry{width=%s%s,headheight=2mm,footskip=2mm,%s}\n' % (linewidth, textheight, orientation)
631 if extra['latexoptions']:
632 s = s + '\geometry{twosideshift=4mm}\n'
635 \usepackage[latin1]{inputenc}
639 if extra['pagenumber'] and extra['pagenumber'][-1] and extra['pagenumber'][-1] != 'no':
640 s = s + '\setcounter{page}{%s}\n' % (extra['pagenumber'][-1])
641 s = s + '\\pagestyle{plain}\n'
643 s = s + '\\pagestyle{empty}\n'
649 def global_latex_definition (tfiles, extra):
650 '''construct preamble from EXTRA, dump Latex stuff for each
651 lily output file in TFILES after that, and return the Latex file constructed. '''
654 s = global_latex_preamble (extra) + '\\begin{document}\n'
655 s = s + '\\thispagestyle{firstpage}\n'
659 s = s + one_latex_definition (t, first)
663 s = s + '\\thispagestyle{lastpage}\n'
664 s = s + '\\end{document}'
668 def run_latex (files, outbase, extra):
670 """Construct latex file, for FILES and EXTRA, dump it into
671 OUTBASE.latex. Run LaTeX on it.
677 latex_fn = outbase + '.latex'
679 wfs = find_tex_files (files, extra)
680 s = global_latex_definition (wfs, extra)
682 f = open (latex_fn, 'w')
686 cmd = 'latex \\\\nonstopmode \\\\input %s' % latex_fn
687 status = quiet_system (cmd, 'LaTeX', ignore_error = 1)
689 signal = 0xf & status
690 exit_stat = status >> 8
693 logstr = open (outbase + '.log').read()
694 m = re.search ("\n!", logstr)
696 logstr = logstr[start:start+200]
698 sys.stderr.write(_("""LaTeX failed on the output file.
699 The error log is as follows:
700 %s...\n""" % logstr))
704 # make a preview by rendering only the 1st line.
705 preview_fn = outbase + '.preview.tex'
706 f = open(preview_fn, 'w')
712 \def\interscoreline{\endinput}
715 ''' % (global_latex_preamble (extra), outbase))
718 cmd = 'latex \\\\nonstopmode \\\\input %s' % preview_fn
719 quiet_system (cmd, "LaTeX for preview")
722 def run_dvips (outbase, extra):
725 """Run dvips using the correct options taken from EXTRA,
726 leaving a PS file in OUTBASE.ps
733 if extra['papersize']:
734 opts = opts + ' -t%s' % extra['papersize'][0]
736 if extra['orientation'] and extra['orientation'][0] == 'landscape':
737 opts = opts + ' -tlandscape'
739 cmd = 'dvips %s -o%s %s' % (opts, outbase + '.ps', outbase + '.dvi')
740 quiet_system (cmd, 'dvips')
743 cmd = 'dvips -E -o%s %s' % ( outbase + '.preview.ps', outbase + '.preview.dvi')
744 quiet_system (cmd, 'dvips for preview')
746 def get_bbox (filename):
748 system ('gs -sDEVICE=bbox -q -sOutputFile=- -dNOPAUSE %s -c quit > %s.bbox 2>&1 ' % (filename, filename))
750 box = open (filename + '.bbox').read()
751 m = re.match ('^%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)', box)
754 gr = map (string.atoi, m.groups ())
759 # cut & paste from lilypond-book.
761 def make_preview (name, extra):
762 bbox = get_bbox (name + '.preview.ps')
764 fo = open (name + '.trans.eps' , 'w')
765 fo.write ('%d %d translate\n' % (-bbox[0]+margin, -bbox[1]+margin))
768 x = (2* margin + bbox[2] - bbox[0]) * preview_resolution / 72.
769 y = (2* margin + bbox[3] - bbox[1]) * preview_resolution / 72.
771 cmd = r'''gs -g%dx%d -sDEVICE=pgm -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=- -r%d -dNOPAUSE %s %s -c quit | pnmtopng > %s'''
773 cmd = cmd % (x, y, preview_resolution, name + '.trans.eps', name + '.preview.ps',name + '.png')
774 quiet_system (cmd, 'gs')
777 status = system (cmd)
779 os.unlink (name + '.png')
780 error ("Removing output file")
784 def generate_dependency_file (depfile, outname):
785 df = open (depfile, 'w')
786 df.write (outname + ':' )
788 for d in dependency_files:
790 s = re.sub ('#[^\n]*\n', '', s)
791 s = re.sub (r'\\\n', ' ', s)
792 m = re.search ('.*:(.*)\n', s)
794 # ugh. Different targets?
796 df.write ( m.group (1) + ' ' )
801 def find_file_in_path (path, name):
802 for d in string.split (path, os.pathsep):
803 if name in os.listdir (d):
804 return os.path.join (d, name)
806 # Added as functionality to ly2dvi, because ly2dvi may well need to do this
809 def find_pfa_fonts (name):
810 s = open (name).read ()
811 if s[:len (PS)] != PS:
813 errorport.write (_( "error: ") + _ ("not a PostScript file: `%s\'" % name))
814 errorport.write ('\n')
817 m = re.match ('.*?/(feta[-a-z0-9]+) +findfont', s[here:], re.DOTALL)
821 pfa.append (m.group (1))
822 m = re.match ('.*?/(feta[-a-z0-9]+) +findfont', s[here:], re.DOTALL)
826 (sh, long) = getopt_args (option_definitions)
828 (options, files) = getopt.getopt(sys.argv[1:], sh, long)
829 except getopt.error, s:
830 errorport.write ('\n')
831 errorport.write (_ ("error: ") + _ ("getopt says: `%s\'" % s))
832 errorport.write ('\n')
833 errorport.write ('\n')
843 elif o == '--help' or o == '-h':
846 elif o == '--find-pfa' or o == '-f':
847 fonts = map (lambda x: x + '.pfa', find_pfa_fonts (a))
848 files = map (lambda x:
849 find_file_in_path (os.environ['GS_FONTPATH'], x),
851 print string.join (files, ' ')
853 elif o == '--include' or o == '-I':
854 include_path.append (a)
855 elif o == '--postscript' or o == '-P':
856 targets.append ('PS')
857 elif o == '--keep' or o == '-k':
859 elif o == '--no-lily':
861 elif o == '--preview':
863 targets.append ('PNG')
864 elif o == '--preview-resolution':
865 preview_resolution = string.atoi (a)
866 elif o == '--no-paper' or o == '-m':
869 elif o == '--output' or o == '-o':
871 elif o == '--set' or o == '-s':
872 ss = string.split (a, '=')
873 set_setting (extra_init, ss[0], ss[1])
874 elif o == '--dependencies' or o == '-d':
875 track_dependencies_p = 1
876 elif o == '--verbose' or o == '-V':
878 elif o == '--version' or o == '-v':
881 elif o == '--warranty' or o == '-w':
882 status = system ('lilypond -w', ignore_error = 1)
888 include_path = map (abspath, include_path)
890 original_output = output_name
893 if files and files[0] != '-':
895 # Ugh, maybe make a setup () function
896 files = map (lambda x: strip_extension (x, '.ly'), files)
898 # hmmm. Wish I'd 've written comments when I wrote this.
899 # now it looks complicated.
901 (outdir, outbase) = ('','')
903 outbase = os.path.basename (files[0])
904 outdir = abspath('.')
905 elif output_name[-1] == os.sep:
906 outdir = abspath (output_name)
907 outbase = os.path.basename (files[0])
909 (outdir, outbase) = os.path.split (abspath (output_name))
911 for i in ('.dvi', '.latex', '.ly', '.ps', '.tex'):
912 output_name = strip_extension (output_name, i)
913 outbase = strip_extension (outbase, i)
914 files = map (abspath, files)
916 for i in files[:] + [output_name]:
917 if string.find (i, ' ') >= 0:
918 user_error (_ ("filename should not contain spaces: `%s'") % i)
920 if os.path.dirname (output_name) != '.':
921 dep_prefix = os.path.dirname (output_name)
925 reldir = os.path.dirname (output_name)
926 if outdir != '.' and (track_dependencies_p or targets):
927 mkdir_p (outdir, 0777)
930 tmpdir = setup_temp ()
932 # to be sure, add tmpdir *in front* of inclusion path.
933 #os.environ['TEXINPUTS'] = tmpdir + ':' + os.environ['TEXINPUTS']
938 run_lilypond (files, outbase, dep_prefix)
940 # TODO: friendly message about LilyPond setup/failing?
942 # TODO: lilypond should fail with different
944 # - guile setup/startup failure
945 # - font setup failure
946 # - init.ly setup failure
947 # - parse error in .ly
948 # - unexpected: assert/core dump
950 traceback.print_exc ()
952 if 'PNG' in targets and 'PS' not in targets:
953 targets.append ('PS')
954 if 'PS' in targets and 'DVI' not in targets:
955 targets.append('DVI')
959 run_latex (files, outbase, extra_init)
960 # unless: add --tex, or --latex?
961 targets.remove ('TEX')
962 targets.remove('LATEX')
964 # TODO: friendly message about TeX/LaTeX setup,
965 # trying to run tex/latex by hand
967 targets.remove ('DVI')
969 targets.remove ('PS')
970 traceback.print_exc ()
974 run_dvips (outbase, extra_init)
977 targets.remove ('PS')
978 traceback.print_exc ()
981 make_preview (outbase, extra_init)
983 # add DEP to targets?
984 if track_dependencies_p:
985 depfile = os.path.join (outdir, outbase + '.dep')
986 generate_dependency_file (depfile, depfile)
987 if os.path.isfile (depfile):
988 progress (_ ("dependencies output to `%s'...") % depfile)
990 # Hmm, if this were a function, we could call it the except: clauses
992 ext = string.lower (i)
993 cp_to_dir ('.*\.%s$' % ext, outdir)
994 outname = outbase + '.' + string.lower (i)
995 abs = os.path.join (outdir, outname)
997 outname = os.path.join (reldir, outname)
998 if os.path.isfile (abs):
999 progress (_ ("%s output to `%s'...") % (i, outname))
1001 warning (_ ("can't find file: `%s'") % outname)
1003 os.chdir (original_dir)
1007 # FIXME: read from stdin when files[0] = '-'
1009 user_error (_ ("no files specified on command line."), 2)