# -*-python-*- import os import string Import ('env') sources = env['src_glob'] (env, '*.tely') pngs = env['src_glob'] (env, '*.png') mfbuild = os.path.join (env['absbuild'], 'mf', env['out']) lilybuild = os.path.join (env['absbuild'], 'lily', env['out']) userbuild = os.path.join (env['absbuild'], 'Documentation/user', env['out']) env.Depends ('lilypond.texi', env['LILYPOND_BIN']) env.Depends ('lilypond.texi', 'lilypond-internals.texi') png_stems = map (lambda x: os.path.splitext (x)[0], pngs) epss = map (env.Png2eps, png_stems) env.Depends ('lilypond.texi', epss) lydir = Dir ('.').srcnode ().abspath + '/../../ly' env.Command ('lilypond-internals.texi', env['LILYPOND_BIN'], 'cd ${TARGET.dir} \ && LILYPONDPREFIX=$LILYPONDPREFIX $LILYPOND_BIN $__verbose \ $lydir/generate-documentation') doc_stems = map (lambda x: os.path.splitext (x)[0], sources) texis = map (env.TELY, doc_stems) dvis = map (env.Texi2dvi, doc_stems) pss = map (env.PostScript, map (lambda x: x + '.dvi', doc_stems)) pdfs = map (env.Dvi2pdf, doc_stems) def file_subst (file_name, find, subst): s = open (file_name).read () t = string.replace (find, subst, s) if s != t: os.rename (file_name, file_name + '~') h = open (file_name, "w") h.write (t) h.close () e = env.Copy () e['usersrc'] = Dir ('.').srcnode ().abspath def url_fixup (target, source, env): file_subst (str (target[0]), '\.\./lilypond-internals', 'lilypond-internals/') a = ['$MAKEINFO -I$usersrc -I${SOURCE.dir} --html \ --css-include=$usersrc/../texinfo.css $__verbose \ --output=${TARGET.dir} $SOURCE', '$MAKEINFO -I$usersrc -I${SOURCE.dir} --html --no-split --no-headers \ --css-include=$usersrc/../texinfo.css $__verbose \ --output=$TARGET $SOURCE', url_fixup, 'ln -f ${SOURCE.dir}/*.png ${SOURCE.dir}/*.ly ${TARGET.dir}/'] e.Command ('lilypond/lilypond.html', 'lilypond.texi', a) e.Command ('lilypond-internals/lilypond-internals.html', 'lilypond-internals.texi', a) env.Alias ('doc', texis) env.Alias ('doc', dvis) env.Alias ('doc', pss) env.Alias ('doc', pdfs) env.Alias ('doc', 'lilypond/lilypond.html') env.Alias ('doc', 'lilypond-internals/lilypond-internals.html')