From: fred Date: Wed, 27 Mar 2002 01:02:39 +0000 (+0000) Subject: lilypond-1.3.148 X-Git-Tag: release/1.5.59~718 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9f4f00ab1edc1f0fe3ea6df6436a9a09935f0930;p=lilypond.git lilypond-1.3.148 --- diff --git a/Documentation/index.texi b/Documentation/index.texi index 2b895d9379..ae488127be 100644 --- a/Documentation/index.texi +++ b/Documentation/index.texi @@ -75,7 +75,6 @@ by computer}. @itemize @bullet -@item @uref{README-W32.html,Compiling and running on Windows32} @item @uref{../misc/out-www/CHANGES-0.0.html, Change logs from 0.0 till 0.1 } @item @uref{../misc/out-www/CHANGES-0.1.html, Change logs from 0.1 till 1.0 } @item @uref{../misc/out-www/CHANGES-1.0.html, Change logs from 1.0 till 1.1 } @@ -90,6 +89,7 @@ changes)} @item @uref{../misc/out-www/ANNOUNCE-1.2.html, Announcement of 1.2 (includes summary of changes)} @item @uref{../misc/out-www/AIMS.html, Why LilyPond?} @item @uref{../misc/out-www/interview.html, Answers} to the Brave GNU world standard questions. +@item @uref{../windows/out-www/lily-wins.html, Lily Wins} @end itemize diff --git a/Documentation/user/tutorial.itely b/Documentation/user/tutorial.itely index 944fdb9142..bc3a3475d2 100644 --- a/Documentation/user/tutorial.itely +++ b/Documentation/user/tutorial.itely @@ -111,6 +111,8 @@ To view the @code{test.dvi} output, run Xdvi (you may omit the xdvi test @end example +@c FIXME: should we say anything on xdvi-gs interaction? + You should see the following in a window next to some buttons. @lilypond \score { @@ -134,13 +136,94 @@ GhostScript's website at @uref{http://www.ghostscript.com}. @cindex PostScript @cindex .ps + @unnumberedsubsec Windows -@strong{[TODO]} -* setting of env vars (TFMFONTS,MFINPUTS,TEXINPUTS) +On windows, you open a LilyPond shell, and then you invoke ly2dvi +compile your lilypond source file, just like on Unix: + +@example +ly2dvi -P test +@end example + +You will see the following on your screen: + +@c FIXME: leave this out, just refer to unix section? +@c FIXME: commands run in dos shell: we can't redirect output +@example +GNU LilyPond 1.3.147 +Now processing: `C:\cygwin\home\tim\ly\test.ly' +Parsing... +Interpreting music...[1] +Preprocessing elements... +Calculating column positions... [2] +paper output to test.tex... + +This is TeX, Version 3.14159 (MiKTeX 2) +LaTeX2e <2000/06/01> +Babel and hyphenation patterns for english, french, german, ngerman, du +mylang, nohyphenation, loaded. + +(test.latex (C:\Program Files\MiKTeX\tex\latex\base\article.cls +Document Class: article 2000/05/19 v1.4b Standard LaTeX document class +(C:\Program Files\MiKTeX\tex\latex\base\size10.clo)) +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\geometry.sty +(C:\Program Files\MiKTeX\tex\latex\graphics\keyval.sty)) +(C:\Program Files\MiKTeX\tex\latex\base\inputenc.sty +(C:\Program Files\MiKTeX\tex\latex\base\latin1.def)) +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\titledefs.tex) +No file test.aux. +(test.tex +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\lilyponddefs.tex +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\lilypond-latex.tex +LaTeX definitions) +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\feta20.tex) +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\lily-ps-defs.tex) +[footer empty] +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\fetdefs.tex))) +Overfull \hbox (15.0pt too wide) in paragraph at lines 22--26 +[] $[]$ +[1] (test.aux) ) +(see the transcript file for additional information) +Output written on test.dvi (1 page, 4292 bytes). +Transcript written on test.log. +This is dvips(k) 5.86 Copyright 1999 Radical Eye Software (www.radicaleye.com) +' TeX output 2001.04.12:0033' -> test.ps +. [1] +Running LilyPond... +Analyzing test.tex... +Running LaTeX... +Running dvips... +PS output to test.ps... +DVI output to test.dvi... +@end example + +To view the @code{test.dvi} output, run Yap + +@example +yap test +@end example + +You should see the following in a window +@lilypond +\score { + \notes { c'4 e' g' } +} +@end lilypond + +@c FIXME: talk about newer Yap versions, proper gs installation? +When you're satisfied with the result, you can print from within Yap +(File/Print). Note that Yap may not display embedded PostScript symbols +such as beams and slurs. Don't worry, they'll be printed anyway. + +You can also print the PostScript file directly from the +command line using GSview: + +@example +gsview32 /s test.ps +@end example -* dvi viewer doesn't display postscript @node The first tune diff --git a/Documentation/windows/GNUmakefile b/Documentation/windows/GNUmakefile index 9e7b37ea23..8351c3d69e 100644 --- a/Documentation/windows/GNUmakefile +++ b/Documentation/windows/GNUmakefile @@ -3,8 +3,11 @@ depth=../.. EXTRA_DIST_FILES = LilyPond.ico $(wildcard *.sh *.patch) -STEPMAKE_TEMPLATES=documentation +STEPMAKE_TEMPLATES=documentation texinfo include $(depth)/make/stepmake.make -default: +default: local-doc + +local-WWW: + diff --git a/Documentation/windows/cygwin-installer.patch b/Documentation/windows/cygwin-installer.patch index a1cc83c86b..551e99db37 100644 --- a/Documentation/windows/cygwin-installer.patch +++ b/Documentation/windows/cygwin-installer.patch @@ -1,17 +1,19 @@ -Binary files ../cinstall/LilyPond.ico and ./LilyPond.ico differ +Only in .: LilyPond.ico diff -urN ../cinstall/Makefile.in ./Makefile.in --- ../cinstall/Makefile.in Thu Feb 8 05:55:22 2001 -+++ ./Makefile.in Sun Apr 8 19:54:54 2001 -@@ -130,11 +130,15 @@ ++++ ./Makefile.in Tue Apr 10 19:20:14 2001 +@@ -130,11 +130,16 @@ @chmod a-x $@ clean: - rm -f *.o *.rc $(PROGS) +- $(MAKE) -C zlib clean + rm -f *.o $(PROGS) - $(MAKE) -C zlib clean ++ $(MAKE) -C zlib $@ realclean: clean rm -f Makefile config.cache ++ rm -f *.d + rm -f inilex.c iniparse.c iniparse.h version.c config.log config.status *.d + + @@ -21,20 +23,19 @@ diff -urN ../cinstall/Makefile.in ./Makefile.in $(SHELL) $(updir1)/mkinstalldirs $(bindir) $(etcdir) diff -urN ../cinstall/desktop.cc ./desktop.cc --- ../cinstall/desktop.cc Sat Nov 11 05:55:16 2000 -+++ ./desktop.cc Sun Apr 8 21:52:48 2001 -@@ -85,6 +85,11 @@ ++++ ./desktop.cc Tue Apr 10 19:15:01 2001 +@@ -79,9 +79,7 @@ + "done", + "", + "export MAKE_MODE=unix", +- "export PS1='\\[\\033]0;\\w\\007", +- "\\033[32m\\]\\u@\\h \\[\\033[33m\\w\\033[0m\\]", +- "$ '", ++ "export PS1='\\[\\033]0;\\w\\007\\033[32m\\]\\u@\\h \\[\\033[33m\\w\\033[0m\\]$ '", "", "cd \"$HOME\"", "", -+ "PATH=\"/usr/lilypond/bin:$PATH\"", -+ "if [ ! -e \"/usr/lilypond\" ]; then", -+ " ln -s `tail -1 /usr/lilypond-*` /usr/lilypond", -+ "fi", -+ "", - "test -f ./.bashrc && . ./.bashrc", - 0 - }; -@@ -197,6 +202,30 @@ +@@ -197,6 +195,30 @@ } static void @@ -65,7 +66,7 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc make_etc_profile () { char *fname = concat (root_dir, "/etc/profile", 0); -@@ -299,11 +328,11 @@ +@@ -299,11 +321,11 @@ } static void @@ -80,7 +81,7 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc if (rsrc == NULL) { fatal ("FindResource failed"); -@@ -323,7 +352,7 @@ +@@ -323,7 +345,7 @@ static void do_desktop_setup() { @@ -89,7 +90,7 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc make_cygwin_bat (); make_etc_profile (); -@@ -335,6 +364,17 @@ +@@ -335,6 +357,17 @@ if (root_desktop) { desktop_icon ("Cygwin", batname); @@ -350,3 +351,4 @@ diff -urN ../cinstall/resource.h ./resource.h #define IDC_SOURCE_DOWNLOAD 1000 #define IDC_SOURCE_NETINST 1001 #define IDC_SOURCE_CWD 1002 +Common subdirectories: ../cinstall/zlib and ./zlib diff --git a/Documentation/windows/lily-python.sh b/Documentation/windows/lily-python.sh new file mode 100644 index 0000000000..c8f71313c6 --- /dev/null +++ b/Documentation/windows/lily-python.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +PATH="//c/Program Files/Python:$PATH" diff --git a/Documentation/windows/lily-tex.sh b/Documentation/windows/lily-tex.sh new file mode 100644 index 0000000000..d2caa6c22b --- /dev/null +++ b/Documentation/windows/lily-tex.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# /etc/profile.d/lily-tex.sh -- Check for TeX or try to setup MiKTeX + +texmf='//c/Program Files/MiKTeX' +texmf_bin='//c/Program Files/MiKTeX/miktex' + +if [ ! -e /usr/share/texmf ]; then + echo /usr/share/texmf not found + if [ -e "$texmf" ]; then + ln -s "$texmf" /usr/share/texmf + echo MiKTeX found: linked to "$texmf" + else + echo setup /usr/share/texmf yourself + fi +fi +if type -p tex; then + echo no TeX in PATH + if [ -e "$texmf_bin" ]; then + echo MiKTeX found: added "$texmf_bin" to PATH + PATH=`cygpath -u "$texmf/miktex"`:"$PATH" + fi +fi + diff --git a/Documentation/windows/lilypond-profile.z.sh b/Documentation/windows/lilypond-profile.z.sh new file mode 100644 index 0000000000..444c94c8ba --- /dev/null +++ b/Documentation/windows/lilypond-profile.z.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# /etc/profile.d/lilypond-profile.z.sh -- profile additions for Windows +# run after lilypond-profile.sh + +POSIX_GS_LIB="$(cygpath -apu $GS_LIB)" +WINDOWS_GS_LIB="$(cygpath -apw $POSIX_GS_LIB)" + +POSIX_GS_FONTPATH="$(cygpath -apu $GS_FONTPATH)" +WINDOWS_GS_FONTPATH="$(cygpath -apw $POSIX_GS_FONTPATH)" + +POSIX_TEXINPUTS="$(cygpath -apu $TEXINPUTS)" +WINDOWS_TEXINPUTS="$(cygpath -apw $POSIX_TEXINPUTS)" + +POSIX_TFMFONTS="$(cygpath -apu $TFMFONTS)" +WINDOWS_TFMFONTS="$(cygpath -apw $POSIX_TFMFONTS)" + +POSIX_MFINPUTS="$(cygpath -apu $MFINPUTS)" +WINDOWS_MFINPUTS="$(cygpath -apw $POSIX_MFINPUTS)" + +# we assume running dos-based TeX, ie, MiKTeX +# maybe move to /etc/profile.d/lily-tex.sh +TEXINPUTS="$WINDOWS_TEXINPUTS" +# TFMFONTS="$WINDOWS_TFMFONTS" + +rm -f /usr/lilypond +# ugh +# ln -s /usr/lilypond-@TOPLEVEL_VERSION@ /usr/lilypond +lily=$(ls -utrd1 /usr/lilypond-* | tail -1) +ln -s $lily /usr/lilypond + +PATH="/usr/lilypond/bin:$PATH" +PATH="$lily/bin:$PATH" + +# gsv-2.7-gs-5.50 +PATH="//c/gstools/gsview://c/gstools/gs:$PATH" + +# gsv-3.6-gs-6.50 +PATH="//c/Ghostgum/gsview://c/gstools/gs:$PATH" + +# python-1.5.2 +PATH="//c/Program Files/Python:$PATH" +PATH="//c/Program Files/MiKTeX/miktex:$PATH" + diff --git a/Documentation/windows/ly2dvi-wrapper.sh b/Documentation/windows/ly2dvi-wrapper.sh new file mode 100644 index 0000000000..1a8a71013d --- /dev/null +++ b/Documentation/windows/ly2dvi-wrapper.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# ly2dvi.sh -- ly2dvi wrapper for Windows + +if echo | python - >/dev/null 2>&1; then + echo +else + cat < #include +#include #if HAVE_SYS_STAT_H #include #endif +#ifdef __CYGWIN__ +#include + +// URGURG +#include "../lily/include/scm-option.hh" +#endif + #include "file-path.hh" @@ -30,6 +38,38 @@ #define EXTSEP '.' #endif + + +#ifdef __CYGWIN__ +static String +dos_to_posix (String path) +{ + char buf[PATH_MAX]; + char *filename = path.copy_ch_p (); + /* urg, wtf? char const* argument gets modified! */ + cygwin_conv_to_posix_path (filename, buf); + delete filename; + return buf; +} + +static String +dos_to_posix_list (String path) +{ + char *filename = path.copy_ch_p (); + int len = cygwin_win32_to_posix_path_list_buf_size (filename); + if (len < PATH_MAX) + len = PATH_MAX; + char *buf = new char[len]; + /* urg, wtf? char const* argument gets modified! */ + cygwin_win32_to_posix_path_list (filename, buf); + delete filename; + + String ret = buf; + delete buf; + return ret; +} +#endif /* __CYGWIN__ */ + /* Join components to full path. */ String Path::str () const @@ -52,6 +92,13 @@ Path::str () const Path split_path (String path) { +#ifdef __CYGWIN__ + /* All system functions would work, even if we don't convert to + posix path, but we'd think that \foe\bar\baz.ly is in the cwd. */ + if (testing_level_global & 1) + path = dos_to_posix (path); +#endif + Path p; int i = path.index_i (ROOTSEP); if (i >= 0) @@ -81,6 +128,11 @@ split_path (String path) void File_path::parse_path (String p) { +#ifdef __CYGWIN__ + if (testing_level_global & 4) + p = dos_to_posix_list (p); +#endif + int l; while ((l = p.length_i ()) ) @@ -162,13 +214,18 @@ File_path::try_add (String s) return false; fclose (f); - push (s); + add (s); return true; } void File_path::add (String s) { +#ifdef __CYGWIN__ + if (testing_level_global & 2) + s = dos_to_posix (s); +#endif + push (s); } diff --git a/lily/include/main.hh b/lily/include/main.hh index a3287237f5..bf3e931892 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -25,7 +25,6 @@ extern void set_inclusion_names (Array); extern bool dependency_global_b; extern String dependency_prefix_global; extern Array dump_header_fieldnames_global; -extern bool midi_debug_global_b; extern bool no_paper_global_b; extern String output_format_global; extern String output_name_global; diff --git a/lily/include/scm-option.hh b/lily/include/scm-option.hh new file mode 100644 index 0000000000..3fe5a748cb --- /dev/null +++ b/lily/include/scm-option.hh @@ -0,0 +1,15 @@ +/* + scm-option.hh -- declare Scheme options + + source file of the GNU LilyPond music typesetter + + (c) 2001 Jan Nieuwenhuizen +*/ +#ifndef SCM_OPTION_HH +#define SCM_OPTION_HH + +/* options */ +extern bool midi_debug_global_b; +extern int testing_level_global; + +#endif /* SCM_OPTION_HH */ diff --git a/lily/main.cc b/lily/main.cc index fe1d00cef8..513054c763 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -101,20 +101,18 @@ static Getopt_long *oparser_p_static = 0; follow regular localisation guidelines). */ static Long_option_init options_static[] = { + {_i ("EXPR"), "evaluate", 'e',_i ("evalute EXPR as Scheme after .scm init is read")}, /* another bug in option parser: --output=foe is taken as an abbreviation for --output-format */ - // {_i ("EXT"), "output-format", 'f', _i ("use output format EXT (scm, ps, tex or as)")}, - {_i ("EXT"), "format", 'f', _i ("use output format EXT (scm, ps, tex or as)")}, {0, "help", 'h', _i ("this help")}, {_i ("FIELD"), "header", 'H', _i ("write header field to BASENAME.FIELD")}, {_i ("DIR"), "include", 'I', _i ("add DIR to search path")}, {_i ("FILE"), "init", 'i', _i ("use FILE as init file")}, {0, "dependencies", 'M', _i ("write Makefile dependencies for every input file")}, - {_i ("DIR"), "dep-prefix", 'P', _i ("prepend DIR to dependencies")}, - {_i ("EXPR"), "evaluate", 'e',_i ("evalute EXPR as Scheme after .scm init is read")}, {0, "no-paper", 'm', _i ("produce MIDI output only")}, {_i ("FILE"), "output", 'o', _i ("write output to FILE")}, + {_i ("DIR"), "dep-prefix", 'P', _i ("prepend DIR to dependencies")}, {0, "safe", 's', _i ("inhibit file output naming and exporting")}, {0, "version", 'v', _i ("print version number")}, {0, "verbose", 'V', _i ("verbose")}, diff --git a/lily/midi-item.cc b/lily/midi-item.cc index fb3d1eb5e6..80d3e6e6bc 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -15,6 +15,7 @@ #include "midi-stream.hh" #include "audio-item.hh" #include "duration.hh" +#include "scm-option.hh" #include "killing-cons.tcc" diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index 359d831834..a2e4d7d5d7 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -15,6 +15,7 @@ #include "midi-item.hh" #include "midi-stream.hh" #include "debug.hh" +#include "scm-option.hh" Midi_stream::Midi_stream (String filename) { diff --git a/lily/scm-option.cc b/lily/scm-option.cc new file mode 100644 index 0000000000..666f08c575 --- /dev/null +++ b/lily/scm-option.cc @@ -0,0 +1,99 @@ +/* + scm-option.cc -- implement option setting from Scheme + + source file of the GNU LilyPond music typesetter + + (c) 2001 Han-Wen Nienhuys + + */ + +#include +#include "string.hh" +#include "lily-guile.hh" +#include "scm-option.hh" + +/* + TODO: mooie onschuldige test, en koel om allerleide dingen te kunnen zetten, + maar is dit nou wel handig voor gebruikert? + + -X, of -fps is hendiger dan + + -e "(set-lily-option 'midi-debug #t)' + + [niet voor niets tiepo in 139 announs..] + +*/ + + +/* Write midi as formatted ascii stream? */ +bool midi_debug_global_b; +/* General purpose testing flag */ +int testing_level_global; + + +/* + + TODO: verzin iets tegen optie code bloot + + + other interesting stuff to add: + +@item -T,--no-timestamps +don't timestamp the output + +@item -t,--test +Switch on any experimental features. Not for general public use. + + */ + +SCM +set_lily_option (SCM var, SCM val) +{ + if (var == ly_symbol2scm ("help")) + { + cout << '\n'; + cout << _ ("Scheme options:"); + cout << "help"; + cout << "midi-debug (boolean)"; + cout << "testing-level (int)"; + cout << '\n'; + exit (0); + } + else if (var == ly_symbol2scm ("midi-debug")) + { + midi_debug_global_b = to_boolean (val); + } + else if (var == ly_symbol2scm ("testing-level")) + { + testing_level_global = gh_scm2int (val); + } + else if (var == ly_symbol2scm ("find-old-relative")) + { + /* + Seems to have been broken for some time! + + @item -Q,--find-old-relative + show all changes needed to convert a file to relative octave syntax. + + + + */ + + ; + + } + + return SCM_UNSPECIFIED; +} + + +static void +init_functions () +{ + scm_make_gsubr ("set-lily-option", 2, 0, 0, (Scheme_function_unknown)set_lily_option); +} + + +ADD_SCM_INIT_FUNC (init_functions_sopt, init_functions); + + diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 4a67ce26e6..56a0450df1 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -45,8 +45,6 @@ TODO: * multiple \score blocks? - * windows-sans-cygwin compatibility? rm -rf, cp file... dir - ''' @@ -56,6 +54,7 @@ import string import re import getopt import sys +import shutil import __main__ import operator import tempfile @@ -111,9 +110,6 @@ targets = { track_dependencies_p = 0 dependency_files = [] -# be verbose? -verbose_p = 0 - # lily_py.py -- options and stuff # @@ -169,17 +165,19 @@ Distributed under terms of the GNU General Public License. It comes with NO WARRANTY.''')) sys.stdout.write ('\n') +if ( os.name == 'posix' ): + errorport=sys.stderr +else: + errorport=sys.stdout + def progress (s): - sys.stderr.write (s + '\n') + errorport.write (s + '\n') def warning (s): - sys.stderr.write (_ ("warning: ") + s) - sys.stderr.write ('\n') - + progress (_ ("warning: ") + s) def error (s): - sys.stderr.write (_ ("error: ") + s) - sys.stderr.write ('\n') + progress (_ ("error: ") + s) raise _ ("Exiting ... ") def getopt_args (opts): @@ -279,7 +277,7 @@ def cleanup_temp (): if not keep_temp_dir_p: if verbose_p: progress (_ ("Cleaning %s...") % temp_dir) - system ('rm -rf %s' % temp_dir) + shutil.rmtree (temp_dir) def set_setting (dict, key, val): @@ -321,9 +319,11 @@ option_definitions = [ def run_lilypond (files, outbase, dep_prefix): opts = '--output=%s.tex' % outbase - opts = opts + ' ' + string.join (map (lambda x : '-I ' + x, include_path)) + opts = opts + ' ' + string.join (map (lambda x : '-I ' + x, + include_path)) if paper_p: - opts = opts + ' ' + string.join (map (lambda x : '-H ' + x, fields)) + opts = opts + ' ' + string.join (map (lambda x : '-H ' + x, + fields)) else: opts = opts + ' --no-paper' @@ -500,7 +500,7 @@ def global_latex_definition (tfiles, extra): first = 0 s = s + r''' -% I don't see why we want to clobber the footer here +% I do not see why we want to clobber the footer here \vfill\hfill\parbox{\textwidth}{\mbox{}\makelilypondtagline} %\makeatletter %\renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\makelilypondtagline}}% @@ -518,7 +518,10 @@ def run_latex (files, outbase, extra): f.write (s) f.close () - cmd = 'latex \\\\nonstopmode \\\\input %s' % outbase + '.latex' + if ( os.name == 'posix' ): + cmd = 'latex \\\\nonstopmode \\\\input %s' % outbase + '.latex' + else: + cmd = 'latex \\nonstopmode \\input %s' % outbase + '.latex' if not verbose_p: progress ( _("Running %s...") % 'LaTeX') cmd = cmd + ' 1> /dev/null 2> /dev/null' @@ -529,16 +532,17 @@ def run_dvips (outbase, extra): opts = '' if extra['papersize']: - opts = opts + ' -t %s' % extra['papersize'][0] + opts = opts + ' -t%s' % extra['papersize'][0] if extra['orientation'] and extra['orientation'][0] == 'landscape': - opts = opts + ' -t landscape' + opts = opts + ' -tlandscape' - cmd = 'dvips %s -o %s %s' % (opts, outbase + '.ps', outbase + '.dvi') + cmd = 'dvips %s -o%s %s' % (opts, outbase + '.ps', outbase + '.dvi') if not verbose_p: progress ( _("Running %s...") % 'dvips') - cmd = cmd + ' 2> /dev/null' + if os.name == 'posix': + cmd = cmd + ' 1> /dev/null 2> /dev/null' system (cmd) @@ -606,12 +610,35 @@ for opt in options: warranty () sys.exit (0) + +def cp_to_dir (pattern, dir): + "Copy files matching re PATTERN from cwd to DIR" + # Duh. Python style portable: cp *.EXT OUTDIR + # system ('cp *.%s %s' % (ext, outdir), 1) + files = filter (lambda x, p=pattern: re.match (p, x), os.listdir ('.')) + map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files) + +# Python < 1.5.2 compatibility +# # On most platforms, this is equivalent to #`normpath(join(os.getcwd()), PATH)'. *Added in Python version 1.5.2* -def compat_abspath (path): - return os.path.normpath (os.path.join (os.getcwd (), path)) +if os.path.__dict__.has_key ('abspath'): + abspath = os.path.abspath +else: + def abspath (path): + return os.path.normpath (os.path.join (os.getcwd (), path)) + +if os.__dict__.has_key ('makedirs'): + makedirs = os.makedirs +else: + def makedirs (dir, mode=0777): + system ('mkdir -p %s' % dir) + +def mkdir_p (dir, mode=0777): + if not os.path.isdir (dir): + makedirs (dir, mode) -include_path = map (compat_abspath, include_path) +include_path = map (abspath, include_path) original_output = output @@ -625,7 +652,7 @@ if files and files[0] != '-': for i in ('.dvi', '.latex', '.ly', '.ps', '.tex'): output = strip_extension (output, i) - files = map (compat_abspath, files) + files = map (abspath, files) if os.path.dirname (output) != '.': dep_prefix = os.path.dirname (output) @@ -633,7 +660,7 @@ if files and files[0] != '-': dep_prefix = 0 reldir = os.path.dirname (output) - (outdir, outbase) = os.path.split (compat_abspath (output)) + (outdir, outbase) = os.path.split (abspath (output)) setup_environment () setup_temp () @@ -674,7 +701,7 @@ if files and files[0] != '-': run_dvips (outbase, extra) if outdir != '.' and (track_dependencies_p or targets.keys ()): - system ('mkdir -p %s' % outdir) + mkdir_p (outdir, 0777) # add DEP to targets? if track_dependencies_p: @@ -685,8 +712,7 @@ if files and files[0] != '-': for i in targets.keys (): ext = string.lower (i) - if re.match ('.*[.]%s' % ext, string.join (os.listdir ('.'))): - system ('cp *.%s %s' % (ext, outdir)) + cp_to_dir ('.*\.%s$' % ext, outdir) outname = outbase + '.' + string.lower (i) abs = os.path.join (outdir, outname) if reldir != '.': @@ -702,7 +728,7 @@ if files and files[0] != '-': else: # FIXME help () - sys.stderr.write ('\n') + progress ('\n') try: error (_ ("no FILEs specified, can't invoke as filter")) except: diff --git a/scripts/update-lily.py b/scripts/update-lily.py index 97e4b58d36..49b6c8170e 100644 --- a/scripts/update-lily.py +++ b/scripts/update-lily.py @@ -415,7 +415,7 @@ if 1: latest = find_latest (url) if os.path.isdir ('%s/%s' % (build_root, latest)): - progress (_ ("latest is %s") % latest) + progress (_ ("latest is: %s") % latest) progress (_ ("relax, %s is up to date" % package_name)) sys.exit (0)