Commits

dirkbaechle committed 54dac1f

- rewrote doc/SConscript, such that all outputs are now created in the build directory

  • Participants
  • Parent commits 80f4a71
  • Branches new_doc_toolchain

Comments (0)

Files changed (6)

     open(t, 'wb').write(contents)
     os.chmod(t, os.stat(s)[0])
 
+revaction = SCons_revision
 revbuilder = Builder(action = Action(SCons_revision,
                                      varlist=['COPYRIGHT', 'VERSION']))
 
 #
 # Documentation.
 #
-Export('build_dir', 'env', 'whereis')
+Export('build_dir', 'env', 'whereis', 'revaction')
 
 SConscript('doc/SConscript')
 

File doc/SConscript

 import os.path
 import re
 import sys
+import glob
 import SConsDoc
 import SConsExamples
 
-Import('build_dir', 'env', 'whereis')
+Import('build_dir', 'env', 'whereis', 'revaction')
 
 env = env.Clone()
 
     #
     date, ver, rev = env.Dictionary('DATE', 'VERSION', 'REVISION')
     version_xml = File(os.path.join(build, "version.xml"))
-    doc_version_xml = File("version.xml")
     writeVersionXml(str(version_xml), date, ver, rev)
-    writeVersionXml(str(doc_version_xml), date, ver, rev)
     
     if not env.GetOption('clean'):
         #
             print "Not all example names and suffixes are unique! Please correct the errors listed above and try again."
             sys.exit(0)
     
-    
+        #
+        # Copy generated files (.gen/.mod/.xml) to the build folder
+        #
+        env.Execute(Mkdir(os.path.join(build, 'generated')))
+        env.Execute(Mkdir(os.path.join(build, 'generated', 'examples')))
+        for g in glob.glob(os.path.join('generated', '*.gen')):
+            env.Execute(Copy(os.path.join(build, 'generated'), g))
+        for g in glob.glob(os.path.join('generated', '*.mod')):
+            env.Execute(Copy(os.path.join(build, 'generated'), g))
+        for g in glob.glob(os.path.join('generated', 'examples', '*')):
+            env.Execute(Copy(os.path.join(build, 'generated', 'examples'), g))
+
+        #
+        # Copy XSLT files (.xslt) to the build folder
+        #
+        env.Execute(Mkdir(os.path.join(build, 'xslt')))
+        for g in glob.glob(os.path.join('xslt','*.*')):
+            env.Execute(Copy(os.path.join(build, 'xslt'), g))
+
+        #
+        # Copy Docbook stylesheets and Tool to the build folder
+        #
+        dbtoolpath = ['src', 'engine', 'SCons', 'Tool', 'docbook']
+        env.Execute(Mkdir(os.path.join(build_dir, *dbtoolpath)))
+        env.Execute(Mkdir(os.path.join(build_dir, *(dbtoolpath + ['utils']))))
+        env.Execute(Copy(os.path.join(build_dir, *dbtoolpath),
+                         os.path.join('..', *(dbtoolpath + ['__init__.py']))))
+        env.Execute(Copy(os.path.join(build_dir, *(dbtoolpath + ['utils'])),
+                         os.path.join('..', *(dbtoolpath + ['utils', 'xmldepend.xsl']))))
+        dbpath = dbtoolpath + ['docbook-xsl-1.76.1']
+        env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['common']))))
+        env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['lib']))))
+        env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['html']))))
+        env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['fo']))))
+        env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['manpages']))))
+        env.Execute(Copy(os.path.join(build_dir, *dbpath),
+                         os.path.join('..', *(dbpath + ['VERSION']))))
+        for g in glob.glob(os.path.join('..', *(dbpath + ['common', '*.*']))):
+            env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['common'])), g))
+        for g in glob.glob(os.path.join('..', *(dbpath + ['lib', '*.*']))):
+            env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['lib'])), g))
+        for g in glob.glob(os.path.join('..', *(dbpath + ['html', '*.*']))):
+            env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['html'])), g))
+        for g in glob.glob(os.path.join('..', *(dbpath + ['fo', '*.*']))):
+            env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['fo'])), g))
+        for g in glob.glob(os.path.join('..', *(dbpath + ['manpages', '*.*']))):
+            env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['manpages'])), g))
+
     #
     # Each document will live in its own subdirectory.  List them here
     # by their subfolder names. Note, how the specifiers for each subdir
     manifest = File('MANIFEST').rstr()
     src_files = [x[:-1] for x in open(manifest).readlines()]
     for s in src_files:
+        if not s:
+            continue
         base, ext = os.path.splitext(s)
         if ext in ['.fig', '.jpg']:
-            orig_env.Install(build, s)
+            env.Execute(Copy(build, s))
         else:
-            orig_env.SCons_revision(os.path.join(build, s), s)
-        Local(os.path.join(build, s))
+            revaction([env.File(os.path.join(build, s))], 
+                      [env.File(s)], env)
 
     #
     # For each document, build the document itself in HTML,
     # and PDF formats.
     #
     for doc in docs:
+        
         #
         # Read MANIFEST file and copy the listed files to the
         # build directory, while branding them with the
         # SCons copyright and the current revision number...
         #
+        env.Execute(Mkdir(os.path.join(build, doc)))
+        env.Execute(Mkdir(os.path.join(build, doc, 'titlepage')))
         manifest = File(os.path.join(doc, 'MANIFEST')).rstr()
         src_files = [x[:-1] for x in open(manifest).readlines()]
         for s in src_files:
+            if not s:
+                continue
             doc_s = os.path.join(doc, s)
             build_s = os.path.join(build, doc, s)
             base, ext = os.path.splitext(doc_s)
-            if ext in ['.fig', '.jpg']:
-                orig_env.InstallAs(build_s, doc_s)
+            if ext in ['.fig', '.jpg', '.svg']:
+                env.Execute(Copy(build_s, doc_s))
             else:
-                orig_env.SCons_revision(build_s, doc_s)
-            Local(build_s)
+                revaction([env.File(build_s)], 
+                          [env.File(doc_s)], env)
 
         #
         # Call SCons in each local doc folder directly, such that
         cleanopt = ''
         if env.GetOption('clean'):
             cleanopt = ' -c'
-        oldwd = os.path.abspath(os.getcwd())
-        os.chdir(doc)
-        os.system(env.subst("$PYTHON ${SCONS_PY.abspath}")+cleanopt)
-        os.chdir(oldwd)
+        cmd = env.subst("cd %s && $PYTHON ${SCONS_PY.abspath}" % os.path.join(build, doc))+cleanopt
+        os.system(cmd)
 
         # Collect the output files for this subfolder
         htmldir = os.path.join(build, 'HTML', 'scons-%s' % doc)
         html = os.path.join(build, 'HTML', 'scons-%s.html' % doc)
         pdf = os.path.join(build, 'PDF', 'scons-%s.pdf' % doc)
         if 'chtml' in docs[doc]:
-            env.Install(htmldir, Glob(os.path.join(doc,'scons-%s' % doc, '*.html')))
+            env.Install(htmldir, Glob(os.path.join(build, doc,'scons-%s' % doc, '*.html')))
             tar_deps.extend([htmlindex])
             tar_list.extend([htmldir])
             Local(htmlindex)
             env.Ignore(htmlindex, version_xml)
 
         if 'html' in docs[doc]:
-            env.InstallAs(html, os.path.join(doc,'index.html'))
+            env.InstallAs(html, os.path.join(build, doc,'index.html'))
             tar_deps.extend([html])
             tar_list.extend([html])
             Local(html)
             env.Ignore(html, version_xml)
             
         if 'pdf' in docs[doc]:
-            env.InstallAs(pdf, os.path.join(doc,'scons-%s.pdf' % doc))
+            env.InstallAs(pdf, os.path.join(build, doc,'scons-%s.pdf' % doc))
             Local(pdf)
             env.Ignore(pdf, version_xml)
 
             # Man page(s)
             #
             for m in man_page_list:
-                x = orig_env.SCons_revision(os.path.join(build, 'man', m),
-                                        os.path.join('man', m))
-            
                 man, _1 = os.path.splitext(m)
             
                 pdf = os.path.join(build, 'PDF', '%s-man.pdf' % man)
                 html = os.path.join(build, 'HTML' , '%s-man.html' % man)
             
-                env.InstallAs(pdf, os.path.join('man','scons-%s.pdf' % man))
-                env.InstallAs(html, os.path.join('man','scons-%s.html' % man))
+                env.InstallAs(pdf, os.path.join(build, 'man','scons-%s.pdf' % man))
+                env.InstallAs(html, os.path.join(build, 'man','scons-%s.html' % man))
             
                 tar_deps.extend([pdf, html])
                 tar_list.extend([pdf, html])

File doc/design/MANIFEST

 copyright.xml
 engine.fig
 engine.jpg
+engine.svg
 engine.xml
 goals.xml
 install.xml
 native.xml
 overview.xml
 summary.xml
+chtml.xsl
+html.xsl
+pdf.xsl
+scons_title.xsl
+scons.css
+SConstruct
+titlepage/bricks.jpg
+titlepage/mapnik_final_colors.svg
+titlepage/SCons_path.svg
+titlepage/SConsBuildBricks_path.svg

File doc/man/MANIFEST

 scons.xml
 sconsign.xml
+scons-time.xml
+html.xsl
+pdf.xsl
+scons_title.xsl
+scons.css
+SConstruct
+titlepage/bricks.jpg
+titlepage/mapnik_final_colors.svg
+titlepage/SCons_path.svg
+titlepage/SConsBuildBricks_path.svg
+

File doc/reference/MANIFEST

 errors.xml
 main.xml
 preface.xml
+chtml.xsl
+html.xsl
+pdf.xsl
+scons_title.xsl
+scons.css
+SConstruct
+titlepage/bricks.jpg
+titlepage/mapnik_final_colors.svg
+titlepage/SCons_path.svg
+titlepage/SConsBuildBricks_path.svg

File doc/user/MANIFEST

 SCons-win32-install-2.jpg
 SCons-win32-install-3.jpg
 SCons-win32-install-4.jpg
+chtml.xsl
+html.xsl
+pdf.xsl
+scons_title.xsl
+scons.css
+SConstruct
+titlepage/bricks.jpg
+titlepage/mapnik_final_colors.svg
+titlepage/SCons_path.svg
+titlepage/SConsBuildBricks_path.svg