]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/SConscript
* SConstruct: Further development.
[lilypond.git] / Documentation / user / SConscript
index 8e6e137ac52f35c7594e51170c7038238a940d32..cc9c31808f3622ae9a5033b4291535bc0e32caf6 100644 (file)
@@ -1,86 +1,66 @@
 # -*-python-*-
 
-import glob
 import os
-
-here = os.getcwd ()
-reldir = str (Dir ('.').srcnode ())
-os.chdir (reldir)
-sources = glob.glob ('*.tely')
-pngs = glob.glob ('*.png')
-os.chdir (here)
+import string
 
 Import ('env')
-e = env.Copy ()
-outdir = os.path.join (env['build'], reldir, env['out'])
-
-# Too late
-e.Append (LILYPOND_BOOK_PATH = [os.path.join (env['srcdir'], reldir, 'user')])
-e['LILYPOND_BOOK_PATH'].append (os.path.join (env['srcdir'], reldir, 'user'))
+telys = env['glob'] (env, '*.tely')
+pngs = env['glob'] (env, '*.png')
 
-def verbose_opt (env, opt):
-       if env['verbose']:
-               return opt
-       return ''
+env.Depends ('lilypond.texi', env['LILYPOND_BIN'])
+env.Depends ('lilypond.texi', 'lilypond-internals.texi')
 
-LILYPOND_BIN = env['LILYPOND_BIN']
-LILYPONDPREFIX = env['LILYPONDPREFIX']
+epss = map (env.Png2eps, pngs)
+env.Depends ('lilypond.texi', epss)
 
-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'])
-e.Depends ('lilypond.texi', os.path.join (mfbuild, 'feta16list.ly'))
-e.Depends ('lilypond.texi', os.path.join (mfbuild, 'parmesan16list.ly'))
-e.Depends ('lilypond.texi', LILYPOND_BIN)
-e.Depends ('lilypond.texi', 'lilypond-internals.texi')
-#e.Depends ('lilypond.texi', os.path.join (lilybuild, 'lilypond-bin'))
+e = env.Copy (
+       LILYPOND_BOOK_FLAGS = '''--process="lilypond-bin -I$srcdir/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"''',
+       __verbose = ' --verbose',
+       )
 
-png_stems = map (lambda x: os.path.splitext (x)[0], pngs)
-epss = map (e.Png2eps, png_stems)
-e.Depends ('lilypond.texi', epss)
+e.Command ('lilypond-internals.texi', env['LILYPOND_BIN'],
+            'cd ${TARGET.dir} \
+            && LILYPONDPREFIX=$LILYPONDPREFIX $LILYPOND_BIN $__verbose \
+            $srcdir/ly/generate-documentation')
 
-e.Command ('lilypond-internals.texi', LILYPOND_BIN,
-          ('(cd ${TARGET.dir} && \
-          LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \
-           + verbose_opt (env, ' --verbose') \
-           + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\
-           + ')') % vars ())
+texis = map (env.TEXI, telys)
+dvis = map (env.Texi2dvi, telys)
+pss = map (env.PostScript, map (lambda x: x + '.dvi', telys))
+pdfs = map (env.Dvi2pdf, telys)
+infos = map (env.INFO, telys)
 
-doc_stems = map (lambda x: os.path.splitext (x)[0], sources)
-texis = map (e.Tely2texi, doc_stems)
-dvis = map (e.Texi2dvi, doc_stems)
-pss = map (e.PostScript, map (lambda x: x + '.dvi', doc_stems))
-pdfs = map (e.Dvi2pdf, doc_stems)
+def file_subst (file_name, find, subst):
+       s = open (file_name).read ()
+       t = string.replace (s, find, subst)
+       if s != t:
+               os.rename (file_name, file_name + '~')
+               h = open (file_name, "w")
+               h.write (t)
+               h.close ()
 
-docdir = os.path.join (env['srcdir'], 'Documentation')
-out = env['out']
-srcdir = env['srcdir']
-##MAKEINFO_INCLUDES = join_path (env['MAKEINFO_PATH'], '', ' -I')
-##MAKEINFO = env['MAKEINFO']
-# TODO: purl (ugh?), symlinks
-verbose = verbose_opt (env, ' --verbose')
-a = ('makeinfo -I%(reldir)s -I${SOURCE.dir}'\
-     + ' --output=${TARGET.dir}'\
-     + ' --css-include=%(docdir)s/texinfo.css'\
-     + ' --html%(verbose)s'\
-     + ' $SOURCE &&' \
-     + ' makeinfo -I%(reldir)s -I${SOURCE.dir}' \
-     + ' --output=$TARGET' \
-     + ' --css-include=%(docdir)s/texinfo.css' \
-     + ' --html --no-split --no-headers %(verbose)s' \
-     + ' $SOURCE') % vars ()
+e['usersrc'] = Dir ('.').srcnode ().abspath
+def url_fixup (target, source, env):
+       file_subst (str (target[0]),
+                   '../lilypond-internals', 'lilypond-internals/')
+a = ['$MAKEINFO -I$srcdir/Documenation/user -I${SOURCE.dir} --html \
+--css-include=$srcdir/Documentation/texinfo.css $__verbose \
+--output=${TARGET.dir} $SOURCE',
+     '$MAKEINFO -I$srcdir/Documentation/user -I${SOURCE.dir} --html \
+     --no-split --no-headers \
+     --css-include=$srcdir/Documentation/../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)
-
-e.Alias ('doc', texis)
-e.Alias ('doc', dvis)
-e.Alias ('doc', pss)
-e.Alias ('doc', pdfs)
+            'lilypond-internals.texi', a)
 
-e.Alias ('doc', 'lilypond-internals/lilypond.html')
-e.Alias ('doc', 'lilypond-internals/lilypond-internals.html')
+#Hmm -- why not just mv ./Documentation/{*,*/*} ./doc :-)
+env.Alias ('doc', texis)
+env.Alias ('doc', dvis)
+env.Alias ('doc', pss)
+env.Alias ('doc', pdfs)
 
-#testing
-all_sources = ['SConscript',] + sources + pngs
-x = env.Tar (env['tarball'], all_sources)
+env.Alias ('doc', 'lilypond/lilypond.html')
+env.Alias ('doc', 'lilypond-internals/lilypond-internals.html')