diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2014-03-01 19:39:19 -0500 |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2014-03-01 19:39:19 -0500 |
commit | ea722a07db6414ac5edb441468358372d785ccfd (patch) | |
tree | eb1d7f5fff7ffefa5f730505ec10d939ca4f7e74 | |
parent | b17b8c2c945aa9bb249a924d2f1fcb678b2f22ac (diff) | |
parent | a2ef1dd444eb8290863f84e19fdd72bddd210ae2 (diff) | |
download | scons-ea722a07db6414ac5edb441468358372d785ccfd.tar.gz |
Merged in dirkbaechle/scons (pull request #106), fix misspelled variable in intelc.py.
85 files changed, 2137 insertions, 159 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index ffba4c1a..57b97f99 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -36,8 +36,6 @@ from TestCmd import PIPE default_version = '2.3.1.alpha.yyyymmdd' -copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013' - python_version_unsupported = (2, 3, 0) python_version_deprecated = (2, 7, 0) @@ -752,3 +752,4 @@ With plenty of help from the SCons Development team: __COPYRIGHT__ + @@ -3,9 +3,7 @@ # # See the README.rst file for an overview of how SCons is built and tested. -# When this gets changed, you must also change the copyright_years string -# in QMTest/TestSCons.py so the test scripts look for the right string. -copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013' +copyright_years = '2001-2014' # This gets inserted into the man pages to reflect the month of release. month_year = 'MONTH YEAR' @@ -1039,7 +1037,10 @@ for p in [ scons ]: if dh_builddeb and fakeroot: # Our Debian packaging builds directly into build/dist, # so we don't need to Install() the .debs. - deb = os.path.join(build_dir, 'dist', "%s_%s_all.deb" % (pkg, version)) + # The built deb is called just x.y.z, not x.y.z.final.0 so strip those off: + deb_version = '.'.join(version.split('.')[0:3]) + deb = os.path.join(build_dir, 'dist', "%s_%s_all.deb" % (pkg, deb_version)) + # print "Building deb into %s (version=%s)"%(deb, deb_version) for d in p['debian_deps']: b = env.SCons_revision(os.path.join(build, d), d) env.Depends(deb, b) diff --git a/bin/update-release-info.py b/bin/update-release-info.py index 338bba91..14894a4f 100644 --- a/bin/update-release-info.py +++ b/bin/update-release-info.py @@ -333,17 +333,18 @@ t.replace_assign('deprecated_python_version', str(deprecated_version)) # Update doc/user/main.{in,xml} docyears = ', '.join(map(str, iter(range(2004, release_date[0] + 1)))) -t = UpdateFile(os.path.join('doc', 'user', 'main.in')) -if DEBUG: t.file = '/tmp/main.in' -## TODO debug these -#t.sub('<pubdate>[^<]*</pubdate>', '<pubdate>' + docyears + '</pubdate>') -#t.sub('<year>[^<]*</year>', '<year>' + docyears + '</year>') +if os.path.exists(os.path.join('doc', 'user', 'main.in')): + # this is no longer used as of Dec 2013 + t = UpdateFile(os.path.join('doc', 'user', 'main.in')) + if DEBUG: t.file = '/tmp/main.in' + ## TODO debug these + #t.sub('<pubdate>[^<]*</pubdate>', '<pubdate>' + docyears + '</pubdate>') + #t.sub('<year>[^<]*</year>', '<year>' + docyears + '</year>') t = UpdateFile(os.path.join('doc', 'user', 'main.xml')) if DEBUG: t.file = '/tmp/main.xml' -## TODO debug these -#t.sub('<pubdate>[^<]*</pubdate>', '<pubdate>' + docyears + '</pubdate>') -#t.sub('<year>[^<]*</year>', '<year>' + docyears + '</year>') +t.sub('<pubdate>[^<]*</pubdate>', '<pubdate>' + docyears + '</pubdate>') +t.sub('<year>[^<]*</year>', '<year>' + docyears + '</year>') # Write out the last update diff --git a/doc/SConscript b/doc/SConscript index 8dcf697c..c731dabb 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -41,6 +41,7 @@ build = os.path.join(build_dir, 'doc') fop = whereis('fop') xep = whereis('xep') epydoc_cli = whereis('epydoc') +gs = whereis('gs') # # @@ -158,6 +159,8 @@ else: 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(Mkdir(os.path.join(build_dir, *(dbpath + ['epub'])))) + env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['xhtml-1_1'])))) env.Execute(Copy(os.path.join(build_dir, *dbpath), os.path.join('..', *(dbpath + ['VERSION'])))) for g in glob.glob(os.path.join('..', *(dbpath + ['common', '*.*']))): @@ -170,6 +173,20 @@ else: 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)) + for g in glob.glob(os.path.join('..', *(dbpath + ['epub', '*.xsl']))): + env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['epub'])), g)) + for g in glob.glob(os.path.join('..', *(dbpath + ['xhtml-1_1', '*.*']))): + env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['xhtml-1_1'])), g)) + + # + # Copy additional Tools (gs, zip) + # + toolpath = ['src', 'engine', 'SCons', 'Tool'] + env.Execute(Copy(os.path.join(build_dir, *toolpath), + os.path.join('..', *(toolpath + ['gs.py'])))) + env.Execute(Copy(os.path.join(build_dir, *toolpath), + os.path.join('..', *(toolpath + ['zip.py'])))) + # # Each document will live in its own subdirectory. List them here @@ -182,8 +199,8 @@ else: #'python10' : ['chtml','html','pdf'], 'reference' : ['chtml','html','pdf'], #'developer' : ['chtml','html','pdf'], - 'user' : ['chtml','html','pdf'], - 'man' : ['man'] + 'user' : ['chtml','html','pdf','epub'], + 'man' : ['man','epub'] } # The names of the target files for the MAN pages man_page_list = ['scons.1','scons-time.1','sconsign.1'] @@ -247,6 +264,7 @@ else: htmlindex = os.path.join(htmldir, 'index.html') html = os.path.join(build, 'HTML', 'scons-%s.html' % doc) pdf = os.path.join(build, 'PDF', 'scons-%s.pdf' % doc) + epub = os.path.join(build, 'EPUB', 'scons-%s.epub' % doc) if 'chtml' in docs[doc]: env.Install(htmldir, Glob(os.path.join(build, doc,'scons-%s' % doc, '*.html'))) tar_deps.extend([htmlindex]) @@ -268,6 +286,14 @@ else: tar_deps.append(pdf) tar_list.append(pdf) + + if 'epub' in docs[doc] and gs: + env.InstallAs(epub, os.path.join(build, doc,'scons-%s.epub' % doc)) + Local(epub) + env.Ignore(epub, version_xml) + + tar_deps.append(epub) + tar_list.append(epub) if 'man' in docs[doc]: # diff --git a/doc/editor_configs/serna/scons/xsd/dbpoolx.xsd b/doc/editor_configs/serna/scons/xsd/dbpoolx.xsd index f0a3f1ca..0ce5cb7b 100644 --- a/doc/editor_configs/serna/scons/xsd/dbpoolx.xsd +++ b/doc/editor_configs/serna/scons/xsd/dbpoolx.xsd @@ -2589,7 +2589,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2616,7 +2615,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2644,7 +2642,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:element ref="summary"/> </xs:choice> diff --git a/doc/editor_configs/xmlmind/addon/config/scons/scons_xsd/dbpoolx.xsd b/doc/editor_configs/xmlmind/addon/config/scons/scons_xsd/dbpoolx.xsd index f0a3f1ca..0ce5cb7b 100644 --- a/doc/editor_configs/xmlmind/addon/config/scons/scons_xsd/dbpoolx.xsd +++ b/doc/editor_configs/xmlmind/addon/config/scons/scons_xsd/dbpoolx.xsd @@ -2589,7 +2589,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2616,7 +2615,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2644,7 +2642,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:element ref="summary"/> </xs:choice> diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index 3fdafb61..41239d4f 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -84,6 +84,32 @@ env.CXXFile(target = 'bar', source = 'bar.yy') </example_commands> </listitem> </varlistentry> + <varlistentry id="b-DocbookEpub"> + <term> + <function>DocbookEpub()</function> + </term> + <term> + <function>env.DocbookEpub()</function> + </term> + <listitem> +<para xmlns="http://www.scons.org/dbxsd/v1.0"> +A pseudo-Builder, providing a Docbook toolchain for EPUB output. +</para> + +<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook']) +env.DocbookEpub('manual.epub', 'manual.xml') +</example_commands> + +<para xmlns="http://www.scons.org/dbxsd/v1.0"> +or simply +</para> + +<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook']) +env.DocbookEpub('manual') +</example_commands> + +</listitem> + </varlistentry> <varlistentry id="b-DocbookHtml"> <term> <function>DocbookHtml()</function> @@ -397,6 +423,27 @@ env.DVI(target = 'ccc.dvi', source = 'ccc.latex') </example_commands> </listitem> </varlistentry> + <varlistentry id="b-Gs"> + <term> + <function>Gs()</function> + </term> + <term> + <function>env.Gs()</function> + </term> + <listitem> +<para xmlns="http://www.scons.org/dbxsd/v1.0"> +A Builder for explicitly calling the <literal>gs</literal> executable. +Depending on the underlying OS, the different names <literal>gs</literal>, +<literal>gsos2</literal> and <literal>gswin32c</literal> +are tried. +</para> +<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['gs']) +env.Gs('cover.jpg','scons-scons.pdf', + GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -q') + ) +</example_commands> +</listitem> + </varlistentry> <varlistentry id="b-Install"> <term> <function>Install()</function> diff --git a/doc/generated/builders.mod b/doc/generated/builders.mod index 59900cc1..50591b45 100644 --- a/doc/generated/builders.mod +++ b/doc/generated/builders.mod @@ -11,6 +11,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-CFile "<function xmlns='http://www.scons.org/dbxsd/v1.0'>CFile</function>"> <!ENTITY b-Command "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Command</function>"> <!ENTITY b-CXXFile "<function xmlns='http://www.scons.org/dbxsd/v1.0'>CXXFile</function>"> +<!ENTITY b-DocbookEpub "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DocbookEpub</function>"> <!ENTITY b-DocbookHtml "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DocbookHtml</function>"> <!ENTITY b-DocbookHtmlChunked "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DocbookHtmlChunked</function>"> <!ENTITY b-DocbookHtmlhelp "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DocbookHtmlhelp</function>"> @@ -21,6 +22,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-DocbookXInclude "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DocbookXInclude</function>"> <!ENTITY b-DocbookXslt "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DocbookXslt</function>"> <!ENTITY b-DVI "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DVI</function>"> +<!ENTITY b-Gs "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Gs</function>"> <!ENTITY b-Install "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Install</function>"> <!ENTITY b-InstallAs "<function xmlns='http://www.scons.org/dbxsd/v1.0'>InstallAs</function>"> <!ENTITY b-InstallVersionedLib "<function xmlns='http://www.scons.org/dbxsd/v1.0'>InstallVersionedLib</function>"> @@ -64,6 +66,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-env-CFile "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.CFile</function>"> <!ENTITY b-env-Command "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Command</function>"> <!ENTITY b-env-CXXFile "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.CXXFile</function>"> +<!ENTITY b-env-DocbookEpub "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DocbookEpub</function>"> <!ENTITY b-env-DocbookHtml "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DocbookHtml</function>"> <!ENTITY b-env-DocbookHtmlChunked "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DocbookHtmlChunked</function>"> <!ENTITY b-env-DocbookHtmlhelp "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DocbookHtmlhelp</function>"> @@ -74,6 +77,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-env-DocbookXInclude "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DocbookXInclude</function>"> <!ENTITY b-env-DocbookXslt "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DocbookXslt</function>"> <!ENTITY b-env-DVI "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DVI</function>"> +<!ENTITY b-env-Gs "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Gs</function>"> <!ENTITY b-env-Install "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Install</function>"> <!ENTITY b-env-InstallAs "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.InstallAs</function>"> <!ENTITY b-env-InstallVersionedLib "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.InstallVersionedLib</function>"> @@ -127,6 +131,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-link-CFile "<link linkend='b-CFile' xmlns='http://www.scons.org/dbxsd/v1.0'><function>CFile</function></link>"> <!ENTITY b-link-Command "<link linkend='b-Command' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Command</function></link>"> <!ENTITY b-link-CXXFile "<link linkend='b-CXXFile' xmlns='http://www.scons.org/dbxsd/v1.0'><function>CXXFile</function></link>"> +<!ENTITY b-link-DocbookEpub "<link linkend='b-DocbookEpub' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DocbookEpub</function></link>"> <!ENTITY b-link-DocbookHtml "<link linkend='b-DocbookHtml' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DocbookHtml</function></link>"> <!ENTITY b-link-DocbookHtmlChunked "<link linkend='b-DocbookHtmlChunked' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DocbookHtmlChunked</function></link>"> <!ENTITY b-link-DocbookHtmlhelp "<link linkend='b-DocbookHtmlhelp' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DocbookHtmlhelp</function></link>"> @@ -137,6 +142,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-link-DocbookXInclude "<link linkend='b-DocbookXInclude' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DocbookXInclude</function></link>"> <!ENTITY b-link-DocbookXslt "<link linkend='b-DocbookXslt' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DocbookXslt</function></link>"> <!ENTITY b-link-DVI "<link linkend='b-DVI' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DVI</function></link>"> +<!ENTITY b-link-Gs "<link linkend='b-Gs' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Gs</function></link>"> <!ENTITY b-link-Install "<link linkend='b-Install' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Install</function></link>"> <!ENTITY b-link-InstallAs "<link linkend='b-InstallAs' xmlns='http://www.scons.org/dbxsd/v1.0'><function>InstallAs</function></link>"> <!ENTITY b-link-InstallVersionedLib "<link linkend='b-InstallVersionedLib' xmlns='http://www.scons.org/dbxsd/v1.0'><function>InstallVersionedLib</function></link>"> @@ -180,6 +186,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-link-env-CFile "<link linkend='b-CFile' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.CFile</function></link>"> <!ENTITY b-link-env-Command "<link linkend='b-Command' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Command</function></link>"> <!ENTITY b-link-env-CXXFile "<link linkend='b-CXXFile' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.CXXFile</function></link>"> +<!ENTITY b-link-env-DocbookEpub "<link linkend='b-DocbookEpub' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DocbookEpub</function></link>"> <!ENTITY b-link-env-DocbookHtml "<link linkend='b-DocbookHtml' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DocbookHtml</function></link>"> <!ENTITY b-link-env-DocbookHtmlChunked "<link linkend='b-DocbookHtmlChunked' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DocbookHtmlChunked</function></link>"> <!ENTITY b-link-env-DocbookHtmlhelp "<link linkend='b-DocbookHtmlhelp' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DocbookHtmlhelp</function></link>"> @@ -190,6 +197,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-link-env-DocbookXInclude "<link linkend='b-DocbookXInclude' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DocbookXInclude</function></link>"> <!ENTITY b-link-env-DocbookXslt "<link linkend='b-DocbookXslt' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DocbookXslt</function></link>"> <!ENTITY b-link-env-DVI "<link linkend='b-DVI' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DVI</function></link>"> +<!ENTITY b-link-env-Gs "<link linkend='b-Gs' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Gs</function></link>"> <!ENTITY b-link-env-Install "<link linkend='b-Install' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Install</function></link>"> <!ENTITY b-link-env-InstallAs "<link linkend='b-InstallAs' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.InstallAs</function></link>"> <!ENTITY b-link-env-InstallVersionedLib "<link linkend='b-InstallVersionedLib' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.InstallVersionedLib</function></link>"> diff --git a/doc/generated/examples/troubleshoot_explain1_3.xml b/doc/generated/examples/troubleshoot_explain1_3.xml new file mode 100644 index 00000000..b62be879 --- /dev/null +++ b/doc/generated/examples/troubleshoot_explain1_3.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<screen xmlns="http://www.scons.org/dbxsd/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0/scons.xsd scons.xsd">% <userinput>scons -Q --warn=target-not-built</userinput> +scons: building `file.out' because it doesn't exist +cp file.in file.oout + +scons: warning: Cannot find target file.out after building +</screen> diff --git a/doc/generated/functions.gen b/doc/generated/functions.gen index 4849ac6d..072b91ca 100644 --- a/doc/generated/functions.gen +++ b/doc/generated/functions.gen @@ -3419,6 +3419,28 @@ Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5) </example_commands> </listitem> </varlistentry> + <varlistentry id="f-Pseudo"> + <term> + <literal>Pseudo(target, ...)</literal> + </term> + <term> + <literal>env.Pseudo(target, ...)</literal> + </term> + <listitem> +<para xmlns="http://www.scons.org/dbxsd/v1.0"> +This indicates that each given +<varname>target</varname> +should not be created by the build rule, and if the target is created, +an error will be generated. This is similar to the gnu make .PHONY +target. However, in the vast majority of cases, an +<function xmlns="http://www.scons.org/dbxsd/v1.0">Alias</function> +is more appropriate. + +Multiple targets can be passed in to a single call to +<function xmlns="http://www.scons.org/dbxsd/v1.0">Pseudo</function>. +</para> +</listitem> + </varlistentry> <varlistentry id="f-RCS"> <term> <literal>env.RCS()</literal> diff --git a/doc/generated/functions.mod b/doc/generated/functions.mod index 0f5dd21a..99aaa480 100644 --- a/doc/generated/functions.mod +++ b/doc/generated/functions.mod @@ -71,6 +71,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY f-PrependENVPath "<function xmlns='http://www.scons.org/dbxsd/v1.0'>PrependENVPath</function>"> <!ENTITY f-PrependUnique "<function xmlns='http://www.scons.org/dbxsd/v1.0'>PrependUnique</function>"> <!ENTITY f-Progress "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Progress</function>"> +<!ENTITY f-Pseudo "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Pseudo</function>"> <!ENTITY f-RCS "<function xmlns='http://www.scons.org/dbxsd/v1.0'>RCS</function>"> <!ENTITY f-Replace "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Replace</function>"> <!ENTITY f-Repository "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Repository</function>"> @@ -158,6 +159,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY f-env-PrependENVPath "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.PrependENVPath</function>"> <!ENTITY f-env-PrependUnique "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.PrependUnique</function>"> <!ENTITY f-env-Progress "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Progress</function>"> +<!ENTITY f-env-Pseudo "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Pseudo</function>"> <!ENTITY f-env-RCS "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.RCS</function>"> <!ENTITY f-env-Replace "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Replace</function>"> <!ENTITY f-env-Repository "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Repository</function>"> @@ -255,6 +257,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY f-link-PrependENVPath "<link linkend='f-PrependENVPath' xmlns='http://www.scons.org/dbxsd/v1.0'><function>PrependENVPath</function></link>"> <!ENTITY f-link-PrependUnique "<link linkend='f-PrependUnique' xmlns='http://www.scons.org/dbxsd/v1.0'><function>PrependUnique</function></link>"> <!ENTITY f-link-Progress "<link linkend='f-Progress' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Progress</function></link>"> +<!ENTITY f-link-Pseudo "<link linkend='f-Pseudo' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Pseudo</function></link>"> <!ENTITY f-link-RCS "<link linkend='f-RCS' xmlns='http://www.scons.org/dbxsd/v1.0'><function>RCS</function></link>"> <!ENTITY f-link-Replace "<link linkend='f-Replace' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Replace</function></link>"> <!ENTITY f-link-Repository "<link linkend='f-Repository' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Repository</function></link>"> @@ -342,6 +345,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY f-link-env-PrependENVPath "<link linkend='f-PrependENVPath' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.PrependENVPath</function></link>"> <!ENTITY f-link-env-PrependUnique "<link linkend='f-PrependUnique' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.PrependUnique</function></link>"> <!ENTITY f-link-env-Progress "<link linkend='f-Progress' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Progress</function></link>"> +<!ENTITY f-link-env-Pseudo "<link linkend='f-Pseudo' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Pseudo</function></link>"> <!ENTITY f-link-env-RCS "<link linkend='f-RCS' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.RCS</function></link>"> <!ENTITY f-link-env-Replace "<link linkend='f-Replace' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Replace</function></link>"> <!ENTITY f-link-env-Repository "<link linkend='f-Repository' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Repository</function></link>"> diff --git a/doc/generated/tools.gen b/doc/generated/tools.gen index 57bb0a24..a0a709e9 100644 --- a/doc/generated/tools.gen +++ b/doc/generated/tools.gen @@ -222,7 +222,7 @@ accordingly. </para> </important> <para xmlns="http://www.scons.org/dbxsd/v1.0">The rules given above are valid for the Builders <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookHtml"><function>DocbookHtml</function></link>, -<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookPdf"><function>DocbookPdf</function></link>, <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookSlidesPdf"><function>DocbookSlidesPdf</function></link> and <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookXInclude"><function>DocbookXInclude</function></link>. For the +<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookPdf"><function>DocbookPdf</function></link>, <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookEpub"><function>DocbookEpub</function></link>, <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookSlidesPdf"><function>DocbookSlidesPdf</function></link> and <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookXInclude"><function>DocbookXInclude</function></link>. For the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookMan"><function>DocbookMan</function></link> transformation you can specify a target name, but the actual output names are automatically set from the <literal>refname</literal> entries in your XML source. @@ -261,6 +261,7 @@ variables for setting the default XSL name is provided. These are: DOCBOOK_DEFAULT_XSL_HTMLCHUNKED DOCBOOK_DEFAULT_XSL_HTMLHELP DOCBOOK_DEFAULT_XSL_PDF +DOCBOOK_DEFAULT_XSL_EPUB DOCBOOK_DEFAULT_XSL_MAN DOCBOOK_DEFAULT_XSL_SLIDESPDF DOCBOOK_DEFAULT_XSL_SLIDESHTML @@ -272,7 +273,7 @@ DOCBOOK_DEFAULT_XSL_SLIDESHTML DOCBOOK_DEFAULT_XSL_PDF='pdf.xsl') env.DocbookHtml('manual') # now uses html.xsl </screen> -<para>Sets: &cv-link-DOCBOOK_DEFAULT_XSL_HTML;, &cv-link-DOCBOOK_DEFAULT_XSL_HTMLCHUNKED;, &cv-link-DOCBOOK_DEFAULT_XSL_HTMLHELP;, &cv-link-DOCBOOK_DEFAULT_XSL_MAN;, &cv-link-DOCBOOK_DEFAULT_XSL_PDF;, &cv-link-DOCBOOK_DEFAULT_XSL_SLIDESHTML;, &cv-link-DOCBOOK_DEFAULT_XSL_SLIDESPDF;, &cv-link-DOCBOOK_FOP;, &cv-link-DOCBOOK_FOPCOM;, &cv-link-DOCBOOK_FOPFLAGS;, &cv-link-DOCBOOK_XMLLINT;, &cv-link-DOCBOOK_XMLLINTCOM;, &cv-link-DOCBOOK_XMLLINTFLAGS;, &cv-link-DOCBOOK_XSLTPROC;, &cv-link-DOCBOOK_XSLTPROCCOM;, &cv-link-DOCBOOK_XSLTPROCFLAGS;, &cv-link-DOCBOOK_XSLTPROCPARAMS;.</para><para>Uses: &cv-link-DOCBOOK_FOPCOMSTR;, &cv-link-DOCBOOK_XMLLINTCOMSTR;, &cv-link-DOCBOOK_XSLTPROCCOMSTR;.</para></listitem> +<para>Sets: &cv-link-DOCBOOK_DEFAULT_XSL_EPUB;, &cv-link-DOCBOOK_DEFAULT_XSL_HTML;, &cv-link-DOCBOOK_DEFAULT_XSL_HTMLCHUNKED;, &cv-link-DOCBOOK_DEFAULT_XSL_HTMLHELP;, &cv-link-DOCBOOK_DEFAULT_XSL_MAN;, &cv-link-DOCBOOK_DEFAULT_XSL_PDF;, &cv-link-DOCBOOK_DEFAULT_XSL_SLIDESHTML;, &cv-link-DOCBOOK_DEFAULT_XSL_SLIDESPDF;, &cv-link-DOCBOOK_FOP;, &cv-link-DOCBOOK_FOPCOM;, &cv-link-DOCBOOK_FOPFLAGS;, &cv-link-DOCBOOK_XMLLINT;, &cv-link-DOCBOOK_XMLLINTCOM;, &cv-link-DOCBOOK_XMLLINTFLAGS;, &cv-link-DOCBOOK_XSLTPROC;, &cv-link-DOCBOOK_XSLTPROCCOM;, &cv-link-DOCBOOK_XSLTPROCFLAGS;, &cv-link-DOCBOOK_XSLTPROCPARAMS;.</para><para>Uses: &cv-link-DOCBOOK_FOPCOMSTR;, &cv-link-DOCBOOK_XMLLINTCOMSTR;, &cv-link-DOCBOOK_XSLTPROCCOMSTR;.</para></listitem> </varlistentry> <varlistentry id="t-dvi"> <term>dvi</term> @@ -444,7 +445,12 @@ Set construction variables for GNU linker/loader. <term>gs</term> <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> -Set construction variables for Ghostscript. +This Tool sets the required construction variables for working with +the Ghostscript command. It also registers an appropriate Action +with the PDF Builder (<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-PDF"><function>PDF</function></link>), such that the conversion from +PS/EPS to PDF happens automatically for the TeX/LaTeX toolchain. +Finally, it adds an explicit Ghostscript Builder (<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-Gs"><function>Gs</function></link>) to the +environment. </para> <para>Sets: &cv-link-GS;, &cv-link-GSCOM;, &cv-link-GSFLAGS;.</para><para>Uses: &cv-link-GSCOMSTR;.</para></listitem> </varlistentry> diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 784cd288..efdac8ef 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -909,6 +909,15 @@ into a list of Dir instances relative to the target being built. </para> </listitem> </varlistentry> + <varlistentry id="cv-DOCBOOK_DEFAULT_XSL_EPUB"> + <term>DOCBOOK_DEFAULT_XSL_EPUB</term> + <listitem> +<para xmlns="http://www.scons.org/dbxsd/v1.0"> +The default XSLT file for the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-DocbookEpub"><function>DocbookEpub</function></link> builder within the +current environment, if no other XSLT gets specified via keyword. +</para> +</listitem> + </varlistentry> <varlistentry id="cv-DOCBOOK_DEFAULT_XSL_HTML"> <term>DOCBOOK_DEFAULT_XSL_HTML</term> <listitem> @@ -2324,7 +2333,7 @@ described above.) <term>GS</term> <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> -The Ghostscript program used to convert PostScript to PDF files. +The Ghostscript program used, e.g. to convert PostScript to PDF files. </para> </listitem> </varlistentry> @@ -2332,7 +2341,8 @@ The Ghostscript program used to convert PostScript to PDF files. <term>GSCOM</term> <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> -The Ghostscript command line used to convert PostScript to PDF files. +The full Ghostscript command line used for the conversion process. Its default +value is <quote><literal>$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES</literal></quote>. </para> </listitem> </varlistentry> @@ -2341,9 +2351,8 @@ The Ghostscript command line used to convert PostScript to PDF files. <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> The string displayed when -Ghostscript is used to convert -a PostScript file to a PDF file. -If this is not set, then <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-GSCOM"><envar>$GSCOM</envar></link> (the command line) is displayed. +Ghostscript is called for the conversion process. +If this is not set (the default), then <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-GSCOM"><envar>$GSCOM</envar></link> (the command line) is displayed. </para> </listitem> </varlistentry> @@ -2351,8 +2360,9 @@ If this is not set, then <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend=" <term>GSFLAGS</term> <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> -General options passed to the Ghostscript program -when converting PostScript to PDF files. +General options passed to the Ghostscript program, +when converting PostScript to PDF files for example. Its default value +is <quote><literal>-dNOPAUSE -dBATCH -sDEVICE=pdfwrite</literal></quote> </para> </listitem> </varlistentry> @@ -3548,6 +3558,9 @@ See <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-msginit"><literal>m Internal ``macro''. Computes locale (language) name based on target filename (default: <literal>'${TARGET.filebase}' </literal>). </para> +<para xmlns="http://www.scons.org/dbxsd/v1.0"> +See <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-msginit"><literal>msginit</literal></link> tool and <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POInit"><function>POInit</function></link> builder. +</para> </listitem> </varlistentry> <varlistentry id="cv-MSGMERGE"> diff --git a/doc/generated/variables.mod b/doc/generated/variables.mod index 8a898ec3..b55b2188 100644 --- a/doc/generated/variables.mod +++ b/doc/generated/variables.mod @@ -70,6 +70,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY cv-DESCRIPTION_lang "<envar xmlns='http://www.scons.org/dbxsd/v1.0'>$DESCRIPTION_lang</envar>"> <!ENTITY cv-Dir "<envar xmlns='http://www.scons.org/dbxsd/v1.0'>$Dir</envar>"> <!ENTITY cv-Dirs "<envar xmlns='http://www.scons.org/dbxsd/v1.0'>$Dirs</envar>"> +<!ENTITY cv-DOCBOOK_DEFAULT_XSL_EPUB "<envar xmlns='http://www.scons.org/dbxsd/v1.0'>$DOCBOOK_DEFAULT_XSL_EPUB</envar>"> <!ENTITY cv-DOCBOOK_DEFAULT_XSL_HTML "<envar xmlns='http://www.scons.org/dbxsd/v1.0'>$DOCBOOK_DEFAULT_XSL_HTML</envar>"> <!ENTITY cv-DOCBOOK_DEFAULT_XSL_HTMLCHUNKED "<envar xmlns='http://www.scons.org/dbxsd/v1.0'>$DOCBOOK_DEFAULT_XSL_HTMLCHUNKED</envar>"> <!ENTITY cv-DOCBOOK_DEFAULT_XSL_HTMLHELP "<envar xmlns='http://www.scons.org/dbxsd/v1.0'>$DOCBOOK_DEFAULT_XSL_HTMLHELP</envar>"> @@ -651,6 +652,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY cv-link-DESCRIPTION_lang "<link linkend='cv-DESCRIPTION_lang' xmlns='http://www.scons.org/dbxsd/v1.0'><envar>$DESCRIPTION_lang</envar></link>"> <!ENTITY cv-link-Dir "<link linkend='cv-Dir' xmlns='http://www.scons.org/dbxsd/v1.0'><envar>$Dir</envar></link>"> <!ENTITY cv-link-Dirs "<link linkend='cv-Dirs' xmlns='http://www.scons.org/dbxsd/v1.0'><envar>$Dirs</envar></link>"> +<!ENTITY cv-link-DOCBOOK_DEFAULT_XSL_EPUB "<link linkend='cv-DOCBOOK_DEFAULT_XSL_EPUB' xmlns='http://www.scons.org/dbxsd/v1.0'><envar>$DOCBOOK_DEFAULT_XSL_EPUB</envar></link>"> <!ENTITY cv-link-DOCBOOK_DEFAULT_XSL_HTML "<link linkend='cv-DOCBOOK_DEFAULT_XSL_HTML' xmlns='http://www.scons.org/dbxsd/v1.0'><envar>$DOCBOOK_DEFAULT_XSL_HTML</envar></link>"> <!ENTITY cv-link-DOCBOOK_DEFAULT_XSL_HTMLCHUNKED "<link linkend='cv-DOCBOOK_DEFAULT_XSL_HTMLCHUNKED' xmlns='http://www.scons.org/dbxsd/v1.0'><envar>$DOCBOOK_DEFAULT_XSL_HTMLCHUNKED</envar></link>"> <!ENTITY cv-link-DOCBOOK_DEFAULT_XSL_HTMLHELP "<link linkend='cv-DOCBOOK_DEFAULT_XSL_HTMLHELP' xmlns='http://www.scons.org/dbxsd/v1.0'><envar>$DOCBOOK_DEFAULT_XSL_HTMLHELP</envar></link>"> diff --git a/doc/man/MANIFEST b/doc/man/MANIFEST index 7f0ad45b..4b3ce9ff 100644 --- a/doc/man/MANIFEST +++ b/doc/man/MANIFEST @@ -5,8 +5,9 @@ scons.xml sconsign.xml scons-time.xml *.xsl -scons.css +*.css SConstruct +cover.jpg titlepage/bricks.jpg titlepage/mapnik_final_colors.svg titlepage/SCons_path.svg diff --git a/doc/man/SConstruct b/doc/man/SConstruct index cd940215..927bfa24 100644 --- a/doc/man/SConstruct +++ b/doc/man/SConstruct @@ -27,7 +27,7 @@ import os env = Environment(ENV={'PATH' : os.environ['PATH']}, - tools=['docbook'], + tools=['docbook','gs','zip'], toolpath=['../../src/engine/SCons/Tool'], DOCBOOK_DEFAULT_XSL_HTML='html.xsl', DOCBOOK_DEFAULT_XSL_PDF='pdf.xsl') @@ -53,3 +53,16 @@ def createManPages(env, target): createManPages(env, "scons") createManPages(env, "sconsign") createManPages(env, "scons-time") + +has_gs = False +if env.WhereIs('gs'): + has_gs = True + +# +# Create the EPUB format +# +if has_gs and has_pdf: + jpg = env.Gs('OEBPS/cover.jpg','scons-scons.pdf', + GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -dJPEGQ=100 -r72x72 -q') + epub = env.DocbookEpub('scons-man.epub', 'scons_db.xml', xsl='epub.xsl') + env.Depends(epub, jpg) diff --git a/doc/man/cover.jpg b/doc/man/cover.jpg Binary files differnew file mode 100644 index 00000000..e2c2cb39 --- /dev/null +++ b/doc/man/cover.jpg diff --git a/doc/man/epub.css b/doc/man/epub.css new file mode 100644 index 00000000..31cebe54 --- /dev/null +++ b/doc/man/epub.css @@ -0,0 +1,33 @@ +/* This defines styles and classes used in the book */ +body { } +code { font-family: monospace; } +h1, h2, h3, h4, h5, h6 { text-align: center; margin-bottom:2em;} +h1.title { } +h2.author { } +p{ + padding:0; + margin:0; + text-indent:2em; +} +blockquote{ + margin-left:3em; + margin-right:3em; +} +.caption{ + text-align:center; + font-style:italic; + margin-bottom:1em; + margin-top:.2em; + font-size:.8em; +} +blockquote > p{ + text-indent:0; + margin-bottom:1em; +} +img{ + display:block; + margin-left: auto; + margin-right: auto; + text-align:center; + margin-top:1em; +} diff --git a/doc/man/epub.xsl b/doc/man/epub.xsl new file mode 100644 index 00000000..bc1d4b3f --- /dev/null +++ b/doc/man/epub.xsl @@ -0,0 +1,35 @@ +<?xml version='1.0'?>
+<!--
+
+ __COPYRIGHT__
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+-->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:import href="../../src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/epub/docbook.xsl"/>
+
+<xsl:param name="html.stylesheet" select="'epub.css'"/>
+
+</xsl:stylesheet>
diff --git a/doc/man/html.xsl b/doc/man/html.xsl index 71a847a3..864af882 100644 --- a/doc/man/html.xsl +++ b/doc/man/html.xsl @@ -51,5 +51,9 @@ reference title set toc,title
</xsl:param>
+<!-- Prevent our EPUB cover image from getting included -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+
</xsl:stylesheet>
diff --git a/doc/man/pdf.xsl b/doc/man/pdf.xsl index 652975f0..f3141030 100644 --- a/doc/man/pdf.xsl +++ b/doc/man/pdf.xsl @@ -67,5 +67,8 @@ set toc,title <xsl:apply-templates select="." mode="vl.as.blocks"/>
</xsl:template>
-</xsl:stylesheet>
+<!-- Prevent our EPUB cover image from getting printed to the PDF -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+</xsl:stylesheet>
diff --git a/doc/man/scons.xml b/doc/man/scons.xml index ab5d35f5..55608474 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -60,6 +60,9 @@ </copyright> <releaseinfo>version &buildversion;</releaseinfo> + + <mediaobject role="cover"><imageobject><imagedata fileref="cover.jpg" format="JPG"/></imageobject></mediaobject> + </referenceinfo> <title>SCons &buildversion;</title> diff --git a/doc/user/MANIFEST b/doc/user/MANIFEST index e5f8988f..62da288d 100644 --- a/doc/user/MANIFEST +++ b/doc/user/MANIFEST @@ -51,7 +51,7 @@ variants.xml variables.xml *.jpg *.xsl -scons.css +*.css SConstruct titlepage/bricks.jpg titlepage/mapnik_final_colors.svg diff --git a/doc/user/SConstruct b/doc/user/SConstruct index 002aea4f..701fb7bc 100644 --- a/doc/user/SConstruct +++ b/doc/user/SConstruct @@ -27,7 +27,7 @@ import os env = Environment(ENV={'PATH' : os.environ['PATH']}, - tools=['docbook'], + tools=['docbook','gs','zip'], toolpath=['../../src/engine/SCons/Tool'], DOCBOOK_DEFAULT_XSL_HTML='html.xsl', DOCBOOK_DEFAULT_XSL_HTMLCHUNKED='chtml.xsl', @@ -51,3 +51,16 @@ env.DocbookHtml('index.html','scons_db.xml') env.DocbookHtmlChunked('index.html', 'scons_db.xml', base_dir='scons-user/') if has_pdf: env.DocbookPdf('scons-user.pdf','scons_db.xml') + +has_gs = False +if env.WhereIs('gs'): + has_gs = True + +# +# Create the EPUB format +# +if has_gs and has_pdf: + jpg = env.Gs('OEBPS/cover.jpg','scons-user.pdf', + GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -dJPEGQ=100 -r72x72 -q') + epub = env.DocbookEpub('scons-user.epub', 'scons_db.xml', xsl='epub.xsl') + env.Depends(epub, jpg) diff --git a/doc/user/chtml.xsl b/doc/user/chtml.xsl index fa01b464..e292c88e 100644 --- a/doc/user/chtml.xsl +++ b/doc/user/chtml.xsl @@ -52,5 +52,9 @@ reference toc,title set toc,title
</xsl:param>
+<!-- Prevent our EPUB cover image from getting included -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+
</xsl:stylesheet>
diff --git a/doc/user/cover.jpg b/doc/user/cover.jpg Binary files differnew file mode 100644 index 00000000..e2c2cb39 --- /dev/null +++ b/doc/user/cover.jpg diff --git a/doc/user/epub.css b/doc/user/epub.css new file mode 100644 index 00000000..31cebe54 --- /dev/null +++ b/doc/user/epub.css @@ -0,0 +1,33 @@ +/* This defines styles and classes used in the book */ +body { } +code { font-family: monospace; } +h1, h2, h3, h4, h5, h6 { text-align: center; margin-bottom:2em;} +h1.title { } +h2.author { } +p{ + padding:0; + margin:0; + text-indent:2em; +} +blockquote{ + margin-left:3em; + margin-right:3em; +} +.caption{ + text-align:center; + font-style:italic; + margin-bottom:1em; + margin-top:.2em; + font-size:.8em; +} +blockquote > p{ + text-indent:0; + margin-bottom:1em; +} +img{ + display:block; + margin-left: auto; + margin-right: auto; + text-align:center; + margin-top:1em; +} diff --git a/doc/user/epub.xsl b/doc/user/epub.xsl new file mode 100644 index 00000000..6ff435ce --- /dev/null +++ b/doc/user/epub.xsl @@ -0,0 +1,36 @@ +<?xml version='1.0'?>
+<!--
+
+ __COPYRIGHT__
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+-->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:import href="../../src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/epub/docbook.xsl"/>
+
+<xsl:param name="html.stylesheet" select="'epub.css'"/>
+
+</xsl:stylesheet>
+
diff --git a/doc/user/html.xsl b/doc/user/html.xsl index 74ea5296..c275c3d1 100644 --- a/doc/user/html.xsl +++ b/doc/user/html.xsl @@ -51,5 +51,9 @@ reference toc,title set toc,title
</xsl:param>
+<!-- Prevent our EPUB cover image from getting included -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+
</xsl:stylesheet>
diff --git a/doc/user/main.xml b/doc/user/main.xml index cb516e14..60dd8c92 100644 --- a/doc/user/main.xml +++ b/doc/user/main.xml @@ -85,6 +85,7 @@ <releaseinfo>version &buildversion;</releaseinfo> + <mediaobject role="cover"><imageobject><imagedata fileref="cover.jpg" format="JPG"/></imageobject></mediaobject> </bookinfo> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="preface.xml"/> diff --git a/doc/user/pdf.xsl b/doc/user/pdf.xsl index 652975f0..9c545925 100644 --- a/doc/user/pdf.xsl +++ b/doc/user/pdf.xsl @@ -67,5 +67,9 @@ set toc,title <xsl:apply-templates select="." mode="vl.as.blocks"/>
</xsl:template>
+<!-- Prevent our EPUB cover image from getting printed to the PDF -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+
</xsl:stylesheet>
diff --git a/doc/user/troubleshoot.xml b/doc/user/troubleshoot.xml index 94af7275..65c91994 100644 --- a/doc/user/troubleshoot.xml +++ b/doc/user/troubleshoot.xml @@ -2,7 +2,7 @@ <!DOCTYPE sconsdoc [ <!ENTITY % scons SYSTEM "../scons.mod"> %scons; - + <!ENTITY % builders-mod SYSTEM "../generated/builders.mod"> %builders-mod; <!ENTITY % functions-mod SYSTEM "../generated/functions.mod"> @@ -160,6 +160,16 @@ file.in </para> <para> + Note that you can also use --warn=target-not-built which checks + whether or not expected targets exist after a build rule is + executed. + </para> + + <scons_output example="troubleshoot_explain1" os="posix" suffix="3"> + <scons_output_command>scons -Q --warn=target-not-built</scons_output_command> + </scons_output> + + <para> The &debug-explain; option also comes in handy to help figure out what input file changed. diff --git a/doc/xsd/dbpoolx.xsd b/doc/xsd/dbpoolx.xsd index f0a3f1ca..0ce5cb7b 100644 --- a/doc/xsd/dbpoolx.xsd +++ b/doc/xsd/dbpoolx.xsd @@ -2589,7 +2589,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2616,7 +2615,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2644,7 +2642,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:element ref="summary"/> </xs:choice> diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 0852fe9c..77fcf401 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Andrew Featherstone: + - Added support for EPUB output format to the DocBook tool. + From Tom Tanner: - Stop leaking file handles to subprocesses by switching to using subprocess always. @@ -43,6 +46,11 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE SCons from a source (non-installed) dir. - Count statistics of instances are now collected only when the --debug=count command-line option is used (#2922). + - Added release_target_info() to File nodes, which helps to + reduce memory consumption in clean builds and update runs + of large projects. + - Fixed the handling of long options in the command-line + parsing (#2929). - Fixed misspelled variable in intelc.py (#2928). From Gary Oberbrunner: diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index d4662780..e9702ff0 100644 --- a/src/engine/SCons/Conftest.py +++ b/src/engine/SCons/Conftest.py @@ -156,7 +156,7 @@ def CheckCC(context): too, so that it can test against non working flags. """ - context.Display("Checking whether the C compiler works") + context.Display("Checking whether the C compiler works... ") text = """ int main() { @@ -176,7 +176,7 @@ def CheckSHCC(context): too, so that it can test against non working flags. """ - context.Display("Checking whether the (shared) C compiler works") + context.Display("Checking whether the (shared) C compiler works... ") text = """ int foo() { @@ -196,7 +196,7 @@ def CheckCXX(context): too, so that it can test against non working flags. """ - context.Display("Checking whether the C++ compiler works") + context.Display("Checking whether the C++ compiler works... ") text = """ int main() { @@ -216,7 +216,7 @@ def CheckSHCXX(context): too, so that it can test against non working flags. """ - context.Display("Checking whether the (shared) C++ compiler works") + context.Display("Checking whether the (shared) C++ compiler works... ") text = """ int main() { diff --git a/src/engine/SCons/Executor.py b/src/engine/SCons/Executor.py index 7875537a..051d275f 100644 --- a/src/engine/SCons/Executor.py +++ b/src/engine/SCons/Executor.py @@ -230,6 +230,8 @@ class Executor(object): self.action_list = action def get_action_list(self): + if self.action_list is None: + return [] return self.pre_actions + self.action_list + self.post_actions def get_all_targets(self): @@ -268,7 +270,8 @@ class Executor(object): """ result = SCons.Util.UniqueList([]) for target in self.get_all_targets(): - result.extend(target.prerequisites) + if target.prerequisites is not None: + result.extend(target.prerequisites) return result def get_action_side_effects(self): @@ -571,7 +574,7 @@ class Null(object): """A null Executor, with a null build Environment, that does nothing when the rest of the methods call it. - This might be able to disapper when we refactor things to + This might be able to disappear when we refactor things to disassociate Builders from Nodes entirely, so we're not going to worry about unit tests for this--at least for now. """ @@ -626,7 +629,6 @@ class Null(object): self._morph() self.set_action_list(action) - # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 18400e84..219718cc 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -2398,6 +2398,8 @@ class File(Base): self.scanner_paths = {} if not hasattr(self, '_local'): self._local = 0 + if not hasattr(self, 'released_target_info'): + self.released_target_info = False # If there was already a Builder set on this entry, then # we need to make sure we call the target-decider function, @@ -2725,7 +2727,7 @@ class File(Base): return self.get_build_env().get_CacheDir().retrieve(self) def visited(self): - if self.exists(): + if self.exists() and self.executor is not None: self.get_build_env().get_CacheDir().push_if_forced(self) ninfo = self.get_ninfo() @@ -2747,6 +2749,58 @@ class File(Base): self.store_info() + def release_target_info(self): + """Called just after this node has been marked + up-to-date or was built completely. + + This is where we try to release as many target node infos + as possible for clean builds and update runs, in order + to minimize the overall memory consumption. + + We'd like to remove a lot more attributes like self.sources + and self.sources_set, but they might get used + in a next build step. For example, during configuration + the source files for a built *.o file are used to figure out + which linker to use for the resulting Program (gcc vs. g++)! + That's why we check for the 'keep_targetinfo' attribute, + config Nodes and the Interactive mode just don't allow + an early release of most variables. + + In the same manner, we can't simply remove the self.attributes + here. The smart linking relies on the shared flag, and some + parts of the java Tool use it to transport information + about nodes... + + @see: built() and Node.release_target_info() + """ + if (self.released_target_info or SCons.Node.interactive): + return + + if not hasattr(self.attributes, 'keep_targetinfo'): + # Cache some required values, before releasing + # stuff like env, executor and builder... + self.changed(allowcache=True) + self.get_contents_sig() + self.get_build_env() + # Now purge unneeded stuff to free memory... + self.executor = None + self._memo.pop('rfile', None) + self.prerequisites = None + # Cleanup lists, but only if they're empty + if not len(self.ignore_set): + self.ignore_set = None + if not len(self.implicit_set): + self.implicit_set = None + if not len(self.depends_set): + self.depends_set = None + if not len(self.ignore): + self.ignore = None + if not len(self.depends): + self.depends = None + # Mark this node as done, we only have to release + # the memory once... + self.released_target_info = True + def find_src_builder(self): if self.rexists(): return None @@ -2957,6 +3011,52 @@ class File(Base): SCons.Node.Node.builder_set(self, builder) self.changed_since_last_build = self.decide_target + def built(self): + """Called just after this File node is successfully built. + + Just like for 'release_target_info' we try to release + some more target node attributes in order to minimize the + overall memory consumption. + + @see: release_target_info + """ + + SCons.Node.Node.built(self) + + if (not SCons.Node.interactive and + not hasattr(self.attributes, 'keep_targetinfo')): + # Ensure that the build infos get computed and cached... + self.store_info() + # ... then release some more variables. + self._specific_sources = False + self.labspath = None + self._save_str() + self.cwd = None + + self.scanner_paths = None + + def changed(self, node=None, allowcache=False): + """ + Returns if the node is up-to-date with respect to the BuildInfo + stored last time it was built. + + For File nodes this is basically a wrapper around Node.changed(), + but we allow the return value to get cached after the reference + to the Executor got released in release_target_info(). + + @see: Node.changed() + """ + if node is None: + try: + return self._memo['changed'] + except KeyError: + pass + + has_changed = SCons.Node.Node.changed(self, node) + if allowcache: + self._memo['changed'] = has_changed + return has_changed + def changed_content(self, target, prev_ni): cur_csig = self.get_csig() try: @@ -3090,25 +3190,50 @@ class File(Base): self.cachedir_csig = self.get_csig() return self.cachedir_csig + def get_contents_sig(self): + """ + A helper method for get_cachedir_bsig. + + It computes and returns the signature for this + node's contents. + """ + + try: + return self.contentsig + except AttributeError: + pass + + executor = self.get_executor() + + result = self.contentsig = SCons.Util.MD5signature(executor.get_contents()) + return result + def get_cachedir_bsig(self): + """ + Return the signature for a cached file, including + its children. + + It adds the path of the cached file to the cache signature, + because multiple targets built by the same action will all + have the same build signature, and we have to differentiate + them somehow. + """ try: return self.cachesig except AttributeError: pass - - # Add the path to the cache signature, because multiple - # targets built by the same action will all have the same - # build signature, and we have to differentiate them somehow. + + # Collect signatures for all children children = self.children() - executor = self.get_executor() - # sigs = [n.get_cachedir_csig() for n in children] sigs = [n.get_cachedir_csig() for n in children] - sigs.append(SCons.Util.MD5signature(executor.get_contents())) + # Append this node's signature... + sigs.append(self.get_contents_sig()) + # ...and it's path sigs.append(self.path) + # Merge this all into a single signature result = self.cachesig = SCons.Util.MD5collect(sigs) return result - default_fs = None def get_default_fs(): diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index d353245d..1f629712 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -100,6 +100,11 @@ def do_nothing(node): pass Annotate = do_nothing +# Gets set to 'True' if we're running in interactive mode. Is +# currently used to release parts of a target's info during +# clean builds and update runs (see release_target_info). +interactive = False + # Classes for signature info for Nodes. class NodeInfoBase(object): @@ -209,7 +214,7 @@ class Node(object): self.depends_set = set() self.ignore = [] # dependencies to ignore self.ignore_set = set() - self.prerequisites = SCons.Util.UniqueList() + self.prerequisites = None self.implicit = None # implicit (scanned) dependencies (None means not scanned yet) self.waiting_parents = set() self.waiting_s_e = set() @@ -292,7 +297,8 @@ class Node(object): except AttributeError: pass else: - executor.cleanup() + if executor is not None: + executor.cleanup() def reset_executor(self): "Remove cached executor; forces recompute when needed." @@ -352,10 +358,11 @@ class Node(object): methods should call this base class method to get the child check and the BuildInfo structure. """ - for d in self.depends: - if d.missing(): - msg = "Explicit dependency `%s' not found, needed by target `%s'." - raise SCons.Errors.StopError(msg % (d, self)) + if self.depends is not None: + for d in self.depends: + if d.missing(): + msg = "Explicit dependency `%s' not found, needed by target `%s'." + raise SCons.Errors.StopError(msg % (d, self)) if self.implicit is not None: for i in self.implicit: if i.missing(): @@ -413,6 +420,23 @@ class Node(object): self.ninfo.update(self) self.store_info() + def release_target_info(self): + """Called just after this node has been marked + up-to-date or was built completely. + + This is where we try to release as many target node infos + as possible for clean builds and update runs, in order + to minimize the overall memory consumption. + + By purging attributes that aren't needed any longer after + a Node (=File) got built, we don't have to care that much how + many KBytes a Node actually requires...as long as we free + the memory shortly afterwards. + + @see: built() and File.release_target_info() + """ + pass + # # # @@ -514,7 +538,7 @@ class Node(object): def is_derived(self): """ - Returns true iff this node is derived (i.e. built). + Returns true if this node is derived (i.e. built). This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build @@ -854,6 +878,8 @@ class Node(object): def add_prerequisite(self, prerequisite): """Adds prerequisites""" + if self.prerequisites is None: + self.prerequisites = SCons.Util.UniqueList() self.prerequisites.extend(prerequisite) self._children_reset() @@ -941,20 +967,14 @@ class Node(object): # dictionary patterns I found all ended up using "not in" # internally anyway...) if self.ignore_set: - if self.implicit is None: - iter = chain(self.sources,self.depends) - else: - iter = chain(self.sources, self.depends, self.implicit) + iter = chain.from_iterable(filter(None, [self.sources, self.depends, self.implicit])) children = [] for i in iter: if i not in self.ignore_set: children.append(i) else: - if self.implicit is None: - children = self.sources + self.depends - else: - children = self.sources + self.depends + self.implicit + children = self.all_children(scan=0) self._memo['children_get'] = children return children @@ -981,10 +1001,7 @@ class Node(object): # using dictionary keys, lose the order, and the only ordered # dictionary patterns I found all ended up using "not in" # internally anyway...) - if self.implicit is None: - return self.sources + self.depends - else: - return self.sources + self.depends + self.implicit + return list(chain.from_iterable(filter(None, [self.sources, self.depends, self.implicit]))) def children(self, scan=1): """Return a list of the node's direct children, minus those @@ -1032,7 +1049,7 @@ class Node(object): def Decider(self, function): SCons.Util.AddMethod(self, function, 'changed_since_last_build') - def changed(self, node=None): + def changed(self, node=None, allowcache=False): """ Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare @@ -1045,6 +1062,15 @@ class Node(object): any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated. + + The allowcache option was added for supporting the early + release of the executor/builder structures, right after + a File target was built. When set to true, the return + value of this changed method gets cached for File nodes. + Like this, the executor isn't needed any longer for subsequent + calls to changed(). + + @see: FS.File.changed(), FS.File.release_target_info() """ t = 0 if t: Trace('changed(%s [%s], %s)' % (self, classname(self), node)) @@ -1120,17 +1146,18 @@ class Node(object): Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node. """ - if self.is_derived() and self.env: + if self.is_derived(): env = self.get_build_env() - for s in self.sources: - scanner = self.get_source_scanner(s) - if scanner: - path = self.get_build_scanner_path(scanner) - else: - path = None - def f(node, env=env, scanner=scanner, path=path): - return node.get_found_includes(env, scanner, path) - return SCons.Util.render_tree(s, f, 1) + if env: + for s in self.sources: + scanner = self.get_source_scanner(s) + if scanner: + path = self.get_build_scanner_path(scanner) + else: + path = None + def f(node, env=env, scanner=scanner, path=path): + return node.get_found_includes(env, scanner, path) + return SCons.Util.render_tree(s, f, 1) else: return None diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index f3a35454..7a8a0c21 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -483,6 +483,9 @@ class SConfBase(object): # so we really control how it gets written. for n in nodes: n.store_info = n.do_not_store_info + if not hasattr(n, 'attributes'): + n.attributes = SCons.Node.Node.Attrs() + n.attributes.keep_targetinfo = 1 ret = 1 diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index e6048860..1cfb05b7 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -182,7 +182,7 @@ class SConfTestCase(unittest.TestCase): self.waiting_parents = set() self.side_effects = [] self.builder = None - self.prerequisites = [] + self.prerequisites = None def disambiguate(self): return self def has_builder(self): diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 7c215191..93380fb1 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -1074,6 +1074,7 @@ def _main(parser): platform = SCons.Platform.platform_module() if options.interactive: + SCons.Node.interactive = True SCons.Script.Interactive.interact(fs, OptionsParser, options, targets, target_top) diff --git a/src/engine/SCons/Script/SConsOptions.py b/src/engine/SCons/Script/SConsOptions.py index 62033ba1..d7262a9d 100644 --- a/src/engine/SCons/Script/SConsOptions.py +++ b/src/engine/SCons/Script/SConsOptions.py @@ -337,6 +337,71 @@ class SConsOptionParser(optparse.OptionParser): option.process(opt, value, values, self) + def reparse_local_options(self): + """ + Re-parse the leftover command-line options stored + in self.largs, so that any value overridden on the + command line is immediately available if the user turns + around and does a GetOption() right away. + + We mimic the processing of the single args + in the original OptionParser._process_args(), but here we + allow exact matches for long-opts only (no partial + argument names!). + + Else, this would lead to problems in add_local_option() + below. When called from there, we try to reparse the + command-line arguments that + 1. haven't been processed so far (self.largs), but + 2. are possibly not added to the list of options yet. + + So, when we only have a value for "--myargument" yet, + a command-line argument of "--myarg=test" would set it. + Responsible for this behaviour is the method + _match_long_opt(), which allows for partial matches of + the option name, as long as the common prefix appears to + be unique. + This would lead to further confusion, because we might want + to add another option "--myarg" later on (see issue #2929). + + """ + rargs = [] + largs_restore = [] + # Loop over all remaining arguments + skip = False + for l in self.largs: + if skip: + # Accept all remaining arguments as they are + largs_restore.append(l) + else: + if len(l) > 2 and l[0:2] == "--": + # Check long option + lopt = (l,) + if "=" in l: + # Split into option and value + lopt = l.split("=", 1) + + if lopt[0] in self._long_opt: + # Argument is already known + rargs.append('='.join(lopt)) + else: + # Not known yet, so reject for now + largs_restore.append('='.join(lopt)) + else: + if l == "--" or l == "-": + # Stop normal processing and don't + # process the rest of the command-line opts + largs_restore.append(l) + skip = True + else: + rargs.append(l) + + # Parse the filtered list + self.parse_args(rargs, self.values) + # Restore the list of remaining arguments for the + # next call of AddOption/add_local_option... + self.largs = self.largs + largs_restore + def add_local_option(self, *args, **kw): """ Adds a local option to the parser. @@ -364,7 +429,7 @@ class SConsOptionParser(optparse.OptionParser): # available if the user turns around and does a GetOption() # right away. setattr(self.values.__defaults__, result.dest, result.default) - self.parse_args(self.largs, self.values) + self.reparse_local_options() return result diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 64ab84da..5de1cda5 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -186,6 +186,8 @@ class Task(object): # or implicit dependencies exists, and also initialize the # .sconsign info. executor = self.targets[0].get_executor() + if executor is None: + return executor.prepare() for t in executor.get_action_targets(): if print_prepare: @@ -289,6 +291,7 @@ class Task(object): post-visit actions that must take place regardless of whether or not the target was an actual built target or a source Node. """ + global print_prepare T = self.tm.trace if T: T.write(self.trace_message('Task.executed_with_callbacks()', self.node)) @@ -301,7 +304,12 @@ class Task(object): if not t.cached: t.push_to_cache() t.built() - t.visited() + t.visited() + if (not print_prepare and + (not hasattr(self, 'options') or not self.options.debug_includes)): + t.release_target_info() + else: + t.visited() executed = executed_with_callbacks @@ -382,6 +390,7 @@ class Task(object): This is the default behavior for building only what's necessary. """ + global print_prepare T = self.tm.trace if T: T.write(self.trace_message(u'Task.make_ready_current()', self.node)) @@ -414,6 +423,9 @@ class Task(object): # parallel build...) t.visited() t.set_state(NODE_UP_TO_DATE) + if (not print_prepare and + (not hasattr(self, 'options') or not self.options.debug_includes)): + t.release_target_info() make_ready = make_ready_current @@ -453,14 +465,15 @@ class Task(object): parents[p] = parents.get(p, 0) + 1 for t in targets: - for s in t.side_effects: - if s.get_state() == NODE_EXECUTING: - s.set_state(NODE_NO_STATE) - for p in s.waiting_parents: - parents[p] = parents.get(p, 0) + 1 - for p in s.waiting_s_e: - if p.ref_count == 0: - self.tm.candidates.append(p) + if t.side_effects is not None: + for s in t.side_effects: + if s.get_state() == NODE_EXECUTING: + s.set_state(NODE_NO_STATE) + for p in s.waiting_parents: + parents[p] = parents.get(p, 0) + 1 + for p in s.waiting_s_e: + if p.ref_count == 0: + self.tm.candidates.append(p) for p, subtract in parents.items(): p.ref_count = p.ref_count - subtract @@ -927,7 +940,11 @@ class Taskmaster(object): if node is None: return None - tlist = node.get_executor().get_all_targets() + executor = node.get_executor() + if executor is None: + return None + + tlist = executor.get_all_targets() task = self.tasker(self, tlist, node in self.original_top, node) try: diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py index 85ade8df..e8751583 100644 --- a/src/engine/SCons/TaskmasterTests.py +++ b/src/engine/SCons/TaskmasterTests.py @@ -49,7 +49,7 @@ class Node(object): self.scanned = 0 self.scanner = None self.targets = [self] - self.prerequisites = [] + self.prerequisites = None class Builder(object): def targets(self, node): return node.targets @@ -141,6 +141,9 @@ class Node(object): self.clear() + def release_target_info(self): + pass + def has_builder(self): return not self.builder is None diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py index caf2b379..ccfe7396 100644 --- a/src/engine/SCons/Tool/MSCommon/common.py +++ b/src/engine/SCons/Tool/MSCommon/common.py @@ -146,9 +146,11 @@ def get_output(vcbat, args = None, env = None): # settings in vs.py. vars = [ 'COMSPEC', -# Still set, but setup script will discard these if registry has values. -# 'VS110COMNTOOLS', -# 'VS100COMNTOOLS', +# VS100 and VS110: Still set, but modern MSVC setup scripts will +# discard these if registry has values. However Intel compiler setup +# script still requires these as of 2013/2014. + 'VS110COMNTOOLS', + 'VS100COMNTOOLS', 'VS90COMNTOOLS', 'VS80COMNTOOLS', 'VS71COMNTOOLS', diff --git a/src/engine/SCons/Tool/docbook/__init__.py b/src/engine/SCons/Tool/docbook/__init__.py index d6713c69..72ea1758 100644 --- a/src/engine/SCons/Tool/docbook/__init__.py +++ b/src/engine/SCons/Tool/docbook/__init__.py @@ -260,6 +260,34 @@ def __xml_scan(node, env, path, arg): docbook_xml_scanner = SCons.Script.Scanner(function = __xml_scan, argument = None) + +# +# Action generators +# +def __generate_xsltproc_action(source, target, env, for_signature): + cmd = env['DOCBOOK_XSLTPROCCOM'] + # Does the environment have a base_dir defined? + base_dir = env.subst('$base_dir') + if base_dir: + # Yes, so replace target path by its filename + return cmd.replace('$TARGET','${TARGET.file}') + return cmd + + +# +# Emitters +# +def __emit_xsl_basedir(target, source, env): + # Does the environment have a base_dir defined? + base_dir = env.subst('$base_dir') + if base_dir: + # Yes, so prepend it to each target + return [os.path.join(base_dir, str(t)) for t in target], source + + # No, so simply pass target and source names through + return target, source + + # # Builders # @@ -290,9 +318,14 @@ def __build_lxml(target, source, env): """ from lxml import etree + xslt_ac = etree.XSLTAccessControl(read_file=True, + write_file=True, + create_dir=True, + read_network=False, + write_network=False) xsl_style = env.subst('$DOCBOOK_XSL') xsl_tree = etree.parse(xsl_style) - transform = etree.XSLT(xsl_tree) + transform = etree.XSLT(xsl_tree, access_control=xslt_ac) doc = etree.parse(str(source[0])) # Support for additional parameters parampass = {} @@ -340,11 +373,13 @@ def __xinclude_lxml(target, source, env): __libxml2_builder = SCons.Builder.Builder( action = __build_libxml2, src_suffix = '.xml', - source_scanner = docbook_xml_scanner) + source_scanner = docbook_xml_scanner, + emitter = __emit_xsl_basedir) __lxml_builder = SCons.Builder.Builder( action = __build_lxml, src_suffix = '.xml', - source_scanner = docbook_xml_scanner) + source_scanner = docbook_xml_scanner, + emitter = __emit_xsl_basedir) __xinclude_libxml2_builder = SCons.Builder.Builder( action = __xinclude_libxml2, @@ -358,9 +393,11 @@ __xinclude_lxml_builder = SCons.Builder.Builder( source_scanner = docbook_xml_scanner) __xsltproc_builder = SCons.Builder.Builder( - action = SCons.Action.Action('$DOCBOOK_XSLTPROCCOM','$DOCBOOK_XSLTPROCCOMSTR'), + action = SCons.Action.CommandGeneratorAction(__generate_xsltproc_action, + {'cmdstr' : '$DOCBOOK_XSLTPROCCOMSTR'}), src_suffix = '.xml', - source_scanner = docbook_xml_scanner) + source_scanner = docbook_xml_scanner, + emitter = __emit_xsl_basedir) __xmllint_builder = SCons.Builder.Builder( action = SCons.Action.Action('$DOCBOOK_XMLLINTCOM','$DOCBOOK_XMLLINTCOMSTR'), suffix = '.xml', @@ -372,6 +409,124 @@ __fop_builder = SCons.Builder.Builder( src_suffix = '.fo', ensure_suffix=1) +def DocbookEpub(env, target, source=None, *args, **kw): + """ + A pseudo-Builder, providing a Docbook toolchain for ePub output. + """ + import zipfile + import shutil + + def build_open_container(target, source, env): + """Generate the *.epub file from intermediate outputs + + Constructs the epub file according to the Open Container Format. This + function could be replaced by a call to the SCons Zip builder if support + was added for different compression formats for separate source nodes. + """ + zf = zipfile.ZipFile(str(target[0]), 'w') + mime_file = open('mimetype', 'w') + mime_file.write('application/epub+zip') + mime_file.close() + zf.write(mime_file.name, compress_type = zipfile.ZIP_STORED) + for s in source: + for dirpath, dirnames, filenames in os.walk(str(s)): + for fname in filenames: + path = os.path.join(dirpath, fname) + if os.path.isfile(path): + zf.write(path, os.path.relpath(path, str(env.get('ZIPROOT', ''))), + zipfile.ZIP_DEFLATED) + zf.close() + + def add_resources(target, source, env): + """Add missing resources to the OEBPS directory + + Ensure all the resources in the manifest are present in the OEBPS directory. + """ + hrefs = [] + content_file = os.path.join(source[0].abspath, 'content.opf') + if not os.path.isfile(content_file): + return + + hrefs = [] + if has_libxml2: + nsmap = {'opf' : 'http://www.idpf.org/2007/opf'} + # Read file and resolve entities + doc = libxml2.readFile(content_file, None, 0) + opf = doc.getRootElement() + # Create xpath context + xpath_context = doc.xpathNewContext() + # Register namespaces + for key, val in nsmap.iteritems(): + xpath_context.xpathRegisterNs(key, val) + + if hasattr(opf, 'xpathEval') and xpath_context: + # Use the xpath context + xpath_context.setContextNode(opf) + items = xpath_context.xpathEval(".//opf:item") + else: + items = opf.findall(".//{'http://www.idpf.org/2007/opf'}item") + + for item in items: + if hasattr(item, 'prop'): + hrefs.append(item.prop('href')) + else: + hrefs.append(item.attrib['href']) + + doc.freeDoc() + xpath_context.xpathFreeContext() + elif has_lxml: + from lxml import etree + + opf = etree.parse(content_file) + # All the opf:item elements are resources + for item in opf.xpath('//opf:item', + namespaces= { 'opf': 'http://www.idpf.org/2007/opf' }): + hrefs.append(item.attrib['href']) + + for href in hrefs: + # If the resource was not already created by DocBook XSL itself, + # copy it into the OEBPS folder + referenced_file = os.path.join(source[0].abspath, href) + if not os.path.exists(referenced_file): + shutil.copy(href, os.path.join(source[0].abspath, href)) + + # Init list of targets/sources + target, source = __extend_targets_sources(target, source) + + # Init XSL stylesheet + __init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_EPUB', ['epub','docbook.xsl']) + + # Setup builder + __builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder) + + # Create targets + result = [] + if not env.GetOption('clean'): + # Ensure that the folders OEBPS and META-INF exist + __create_output_dir('OEBPS/') + __create_output_dir('META-INF/') + dirs = env.Dir(['OEBPS', 'META-INF']) + + # Set the fixed base_dir + kw['base_dir'] = 'OEBPS/' + tocncx = __builder.__call__(env, 'toc.ncx', source[0], **kw) + cxml = env.File('META-INF/container.xml') + env.SideEffect(cxml, tocncx) + + env.Depends(tocncx, kw['DOCBOOK_XSL']) + result.extend(tocncx+[cxml]) + + container = env.Command(__ensure_suffix(str(target[0]), '.epub'), + tocncx+[cxml], [add_resources, build_open_container]) + mimetype = env.File('mimetype') + env.SideEffect(mimetype, container) + + result.extend(container) + # Add supporting files for cleanup + env.Clean(tocncx, dirs) + + return result + def DocbookHtml(env, target, source=None, *args, **kw): """ A pseudo-Builder, providing a Docbook toolchain for HTML output. @@ -420,11 +575,11 @@ def DocbookHtmlChunked(env, target, source=None, *args, **kw): # Create targets result = [] - r = __builder.__call__(env, base_dir+__ensure_suffix(str(target[0]), '.html'), source[0], **kw) + r = __builder.__call__(env, __ensure_suffix(str(target[0]), '.html'), source[0], **kw) env.Depends(r, kw['DOCBOOK_XSL']) result.extend(r) # Add supporting files for cleanup - env.Clean(r, glob.glob(base_dir+'*.html')) + env.Clean(r, glob.glob(os.path.join(base_dir, '*.html'))) return result @@ -455,12 +610,12 @@ def DocbookHtmlhelp(env, target, source=None, *args, **kw): # Create targets result = [] - r = __builder.__call__(env, base_dir+__ensure_suffix(str(target[0]), '.html'), source[0], **kw) + r = __builder.__call__(env, __ensure_suffix(str(target[0]), '.html'), source[0], **kw) env.Depends(r, kw['DOCBOOK_XSL']) result.extend(r) # Add supporting files for cleanup env.Clean(r, ['toc.hhc', 'htmlhelp.hhp', 'index.hhk'] + - glob.glob(base_dir+'[ar|bk|ch]*.html')) + glob.glob(os.path.join(base_dir, '[ar|bk|ch]*.html'))) return result @@ -605,12 +760,12 @@ def DocbookSlidesHtml(env, target, source=None, *args, **kw): # Create targets result = [] - r = __builder.__call__(env, base_dir+__ensure_suffix(str(target[0]), '.html'), source[0], **kw) + r = __builder.__call__(env, __ensure_suffix(str(target[0]), '.html'), source[0], **kw) env.Depends(r, kw['DOCBOOK_XSL']) result.extend(r) # Add supporting files for cleanup - env.Clean(r, [base_dir+'toc.html'] + - glob.glob(base_dir+'foil*.html')) + env.Clean(r, [os.path.join(base_dir, 'toc.html')] + + glob.glob(os.path.join(base_dir, 'foil*.html'))) return result @@ -654,19 +809,19 @@ def DocbookXslt(env, target, source=None, *args, **kw): return result - def generate(env): """Add Builders and construction variables for docbook to an Environment.""" env.SetDefault( # Default names for customized XSL stylesheets - DOCBOOK_DEFAULT_XSL_HTML = '', - DOCBOOK_DEFAULT_XSL_HTMLCHUNKED = '', - DOCBOOK_DEFAULT_XSL_HTMLHELP = '', - DOCBOOK_DEFAULT_XSL_PDF = '', - DOCBOOK_DEFAULT_XSL_MAN = '', - DOCBOOK_DEFAULT_XSL_SLIDESPDF = '', - DOCBOOK_DEFAULT_XSL_SLIDESHTML = '', + DOCBOOK_DEFAULT_XSL_EPUB = '', + DOCBOOK_DEFAULT_XSL_HTML = '', + DOCBOOK_DEFAULT_XSL_HTMLCHUNKED = '', + DOCBOOK_DEFAULT_XSL_HTMLHELP = '', + DOCBOOK_DEFAULT_XSL_PDF = '', + DOCBOOK_DEFAULT_XSL_MAN = '', + DOCBOOK_DEFAULT_XSL_SLIDESPDF = '', + DOCBOOK_DEFAULT_XSL_SLIDESHTML = '', # Paths to the detected executables DOCBOOK_XSLTPROC = '', @@ -693,6 +848,7 @@ def generate(env): _detect(env) try: + env.AddMethod(DocbookEpub, "DocbookEpub") env.AddMethod(DocbookHtml, "DocbookHtml") env.AddMethod(DocbookHtmlChunked, "DocbookHtmlChunked") env.AddMethod(DocbookHtmlhelp, "DocbookHtmlhelp") @@ -705,6 +861,7 @@ def generate(env): except AttributeError: # Looks like we use a pre-0.98 version of SCons... from SCons.Script.SConscript import SConsEnvironment + SConsEnvironment.DocbookEpub = DocbookEpub SConsEnvironment.DocbookHtml = DocbookHtml SConsEnvironment.DocbookHtmlChunked = DocbookHtmlChunked SConsEnvironment.DocbookHtmlhelp = DocbookHtmlhelp diff --git a/src/engine/SCons/Tool/docbook/__init__.xml b/src/engine/SCons/Tool/docbook/__init__.xml index be2f2cab..07487384 100644 --- a/src/engine/SCons/Tool/docbook/__init__.xml +++ b/src/engine/SCons/Tool/docbook/__init__.xml @@ -97,7 +97,7 @@ accordingly. </para> </important> <para>The rules given above are valid for the Builders &b-link-DocbookHtml;, -&b-link-DocbookPdf;, &b-link-DocbookSlidesPdf; and &b-link-DocbookXInclude;. For the +&b-link-DocbookPdf;, &b-link-DocbookEpub;, &b-link-DocbookSlidesPdf; and &b-link-DocbookXInclude;. For the &b-link-DocbookMan; transformation you can specify a target name, but the actual output names are automatically set from the <literal>refname</literal> entries in your XML source. @@ -136,6 +136,7 @@ variables for setting the default XSL name is provided. These are: DOCBOOK_DEFAULT_XSL_HTMLCHUNKED DOCBOOK_DEFAULT_XSL_HTMLHELP DOCBOOK_DEFAULT_XSL_PDF +DOCBOOK_DEFAULT_XSL_EPUB DOCBOOK_DEFAULT_XSL_MAN DOCBOOK_DEFAULT_XSL_SLIDESPDF DOCBOOK_DEFAULT_XSL_SLIDESHTML @@ -153,6 +154,7 @@ env.DocbookHtml('manual') # now uses html.xsl <item>DOCBOOK_DEFAULT_XSL_HTMLCHUNKED</item> <item>DOCBOOK_DEFAULT_XSL_HTMLHELP</item> <item>DOCBOOK_DEFAULT_XSL_PDF</item> +<item>DOCBOOK_DEFAULT_XSL_EPUB</item> <item>DOCBOOK_DEFAULT_XSL_MAN</item> <item>DOCBOOK_DEFAULT_XSL_SLIDESPDF</item> <item>DOCBOOK_DEFAULT_XSL_SLIDESHTML</item> @@ -212,6 +214,15 @@ current environment, if no other XSLT gets specified via keyword. </summary> </cvar> +<cvar name="DOCBOOK_DEFAULT_XSL_EPUB"> +<summary> +<para> +The default XSLT file for the &b-link-DocbookEpub; builder within the +current environment, if no other XSLT gets specified via keyword. +</para> +</summary> +</cvar> + <cvar name="DOCBOOK_DEFAULT_XSL_MAN"> <summary> <para> @@ -473,6 +484,27 @@ env.DocbookPdf('manual') </summary> </builder> +<builder name="DocbookEpub"> +<summary> +<para> +A pseudo-Builder, providing a Docbook toolchain for EPUB output. +</para> + +<example_commands>env = Environment(tools=['docbook']) +env.DocbookEpub('manual.epub', 'manual.xml') +</example_commands> + +<para> +or simply +</para> + +<example_commands>env = Environment(tools=['docbook']) +env.DocbookEpub('manual') +</example_commands> + +</summary> +</builder> + <builder name="DocbookMan"> <summary> <para> diff --git a/src/engine/SCons/Tool/gs.py b/src/engine/SCons/Tool/gs.py index ada169ac..6e31ee27 100644 --- a/src/engine/SCons/Tool/gs.py +++ b/src/engine/SCons/Tool/gs.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Action +import SCons.Builder import SCons.Platform import SCons.Util @@ -52,17 +53,26 @@ GhostscriptAction = None def generate(env): """Add Builders and construction variables for Ghostscript to an Environment.""" - global GhostscriptAction - if GhostscriptAction is None: - GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR') - - import pdf - pdf.generate(env) - - bld = env['BUILDERS']['PDF'] - bld.add_action('.ps', GhostscriptAction) - + # The following try-except block enables us to use the Tool + # in standalone mode (without the accompanying pdf.py), + # whenever we need an explicit call of gs via the Gs() + # Builder ... + try: + if GhostscriptAction is None: + GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR') + + import pdf + pdf.generate(env) + + bld = env['BUILDERS']['PDF'] + bld.add_action('.ps', GhostscriptAction) + except ImportError, e: + pass + + gsbuilder = SCons.Builder.Builder(action = SCons.Action.Action('$GSCOM', '$GSCOMSTR')) + env['BUILDERS']['Gs'] = gsbuilder + env['GS'] = gs env['GSFLAGS'] = SCons.Util.CLVar('-dNOPAUSE -dBATCH -sDEVICE=pdfwrite') env['GSCOM'] = '$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/gs.xml b/src/engine/SCons/Tool/gs.xml index c34f0047..3fe51651 100644 --- a/src/engine/SCons/Tool/gs.xml +++ b/src/engine/SCons/Tool/gs.xml @@ -26,7 +26,12 @@ See its __doc__ string for a discussion of the format. <tool name="gs"> <summary> <para> -Set construction variables for Ghostscript. +This Tool sets the required construction variables for working with +the Ghostscript command. It also registers an appropriate Action +with the PDF Builder (&b-link-PDF;), such that the conversion from +PS/EPS to PDF happens automatically for the TeX/LaTeX toolchain. +Finally, it adds an explicit Ghostscript Builder (&b-link-Gs;) to the +environment. </para> </summary> <sets> @@ -42,7 +47,7 @@ Set construction variables for Ghostscript. <cvar name="GS"> <summary> <para> -The Ghostscript program used to convert PostScript to PDF files. +The Ghostscript program used, e.g. to convert PostScript to PDF files. </para> </summary> </cvar> @@ -50,7 +55,8 @@ The Ghostscript program used to convert PostScript to PDF files. <cvar name="GSCOM"> <summary> <para> -The Ghostscript command line used to convert PostScript to PDF files. +The full Ghostscript command line used for the conversion process. Its default +value is <quote><literal>$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES</literal></quote>. </para> </summary> </cvar> @@ -59,9 +65,8 @@ The Ghostscript command line used to convert PostScript to PDF files. <summary> <para> The string displayed when -Ghostscript is used to convert -a PostScript file to a PDF file. -If this is not set, then &cv-link-GSCOM; (the command line) is displayed. +Ghostscript is called for the conversion process. +If this is not set (the default), then &cv-link-GSCOM; (the command line) is displayed. </para> </summary> </cvar> @@ -69,10 +74,27 @@ If this is not set, then &cv-link-GSCOM; (the command line) is displayed. <cvar name="GSFLAGS"> <summary> <para> -General options passed to the Ghostscript program -when converting PostScript to PDF files. +General options passed to the Ghostscript program, +when converting PostScript to PDF files for example. Its default value +is <quote><literal>-dNOPAUSE -dBATCH -sDEVICE=pdfwrite</literal></quote> </para> </summary> </cvar> +<builder name="Gs"> +<summary> +<para> +A Builder for explicitly calling the <literal>gs</literal> executable. +Depending on the underlying OS, the different names <literal>gs</literal>, +<literal>gsos2</literal> and <literal>gswin32c</literal> +are tried. +</para> +<example_commands>env = Environment(tools=['gs']) +env.Gs('cover.jpg','scons-scons.pdf', + GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -q') + ) +</example_commands> +</summary> +</builder> + </sconsdoc>
\ No newline at end of file diff --git a/src/engine/SCons/Tool/msginit.xml b/src/engine/SCons/Tool/msginit.xml index 0f89020a..7ce785cf 100644 --- a/src/engine/SCons/Tool/msginit.xml +++ b/src/engine/SCons/Tool/msginit.xml @@ -216,8 +216,10 @@ See &t-link-msginit; tool and &b-link-POInit; builder. Internal ``macro''. Computes locale (language) name based on target filename (default: <literal>'${TARGET.filebase}' </literal>). </para> -</summary> +<para> See &t-link-msginit; tool and &b-link-POInit; builder. +</para> +</summary> </cvar> </sconsdoc>
\ No newline at end of file diff --git a/src/engine/SCons/Tool/rpm.py b/src/engine/SCons/Tool/rpm.py index 26d21099..1f6eafe0 100644 --- a/src/engine/SCons/Tool/rpm.py +++ b/src/engine/SCons/Tool/rpm.py @@ -79,7 +79,7 @@ def build_rpm(target, source, env): errstr=output, filename=str(target[0]) ) else: - # XXX: assume that LC_ALL=c is set while running rpmbuild + # XXX: assume that LC_ALL=C is set while running rpmbuild output_files = re.compile( 'Wrote: (.*)' ).findall( output ) for output, input in zip( output_files, target ): @@ -117,7 +117,7 @@ def generate(env): bld = RpmBuilder env['BUILDERS']['Rpm'] = bld - env.SetDefault(RPM = 'LC_ALL=c rpmbuild') + env.SetDefault(RPM = 'LC_ALL=C rpmbuild') env.SetDefault(RPMFLAGS = SCons.Util.CLVar('-ta')) env.SetDefault(RPMCOM = rpmAction) env.SetDefault(RPMSUFFIX = '.rpm') diff --git a/test/AddOption/longopts.py b/test/AddOption/longopts.py new file mode 100644 index 00000000..47ae4f17 --- /dev/null +++ b/test/AddOption/longopts.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verifies that the default name matching of optparse for long options +gets properly suppressed. We don't allow for partial matching +of argument names, because it would lead to trouble in the test +case below... +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """\ +AddOption('--myargument', dest='myargument', type='string', default='gully') +AddOption('--myarg', dest='myarg', type='string', default='balla') +print("myargument: " + str(GetOption('myargument'))) +print("myarg: " + str(GetOption('myarg'))) +""") + +test.run('-Q -q .', + stdout="myargument: gully\nmyarg: balla\n") + +test.run('-Q -q . --myargument=helloworld', + stdout="myargument: helloworld\nmyarg: balla\n") + +test.run('-Q -q . --myarg=helloworld', + stdout="myargument: gully\nmyarg: helloworld\n") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Depends/spurious-rebuilds.py b/test/Depends/spurious-rebuilds.py new file mode 100644 index 00000000..6afc829d --- /dev/null +++ b/test/Depends/spurious-rebuilds.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +After adding some code for reducing the overall memory consumption in +revision b4bc497, a number of spurious rebuilds was observed by different +people. The problem was, that the value of the Node.changed() method got cached +too early for File nodes. + +This test verifies that the changed() function works properly, especially +in connection with auto-generated sources, combined with an explicit Depends(). +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """\ +# This tests the too-many-rebuilds problem with SCons 2.3.1 (test) +# Run like this: scons all-defuns.obj + +# Test setup (only runs once) +import os.path +if not os.path.exists('mkl'): + os.mkdir('mkl') +if not os.path.exists('test.c'): + open('test.c', 'w').write('int i;') + +env=Environment() +env.SharedObject('all-defuns.obj', 'all-defuns.c') +results = env.Command('all-defuns.c', 'test.c', Copy('$TARGET', '$SOURCE')) +env.Depends(results, '#mkl') +""") + +test.run(arguments = 'all-defuns.obj') + +test.must_exist('all-defuns.c') +test.must_exist('test.c') +test.must_exist('all-defuns.obj') + +test.up_to_date(arguments = 'all-defuns.obj') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basedir/htmlchunked/htmlchunked.py b/test/Docbook/basedir/htmlchunked/htmlchunked.py index c5817017..cf5f3d17 100644 --- a/test/Docbook/basedir/htmlchunked/htmlchunked.py +++ b/test/Docbook/basedir/htmlchunked/htmlchunked.py @@ -26,10 +26,16 @@ Test the base_dir argument for the chunked HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('Wrong OS or no stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/basedir/htmlchunked/htmlchunked_cmd.py b/test/Docbook/basedir/htmlchunked/htmlchunked_cmd.py new file mode 100644 index 00000000..b507eb12 --- /dev/null +++ b/test/Docbook/basedir/htmlchunked/htmlchunked_cmd.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the base_dir argument for the chunked HTML builder while using +the xsltproc executable, if it exists. +""" + +import os +import sys +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not (xsltproc and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('No xsltproc or no stylesheets installed, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('output/index.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('output/index.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd b/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd new file mode 100644 index 00000000..d981b284 --- /dev/null +++ b/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd @@ -0,0 +1,2 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtmlChunked('manual', xsl='html.xsl', base_dir='output/') diff --git a/test/Docbook/basedir/htmlhelp/htmlhelp.py b/test/Docbook/basedir/htmlhelp/htmlhelp.py index 736f7322..22bbd72a 100644 --- a/test/Docbook/basedir/htmlhelp/htmlhelp.py +++ b/test/Docbook/basedir/htmlhelp/htmlhelp.py @@ -26,10 +26,16 @@ Test the base_dir argument for the HTMLHELP builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('Wrong OS or no stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/basedir/htmlhelp/htmlhelp_cmd.py b/test/Docbook/basedir/htmlhelp/htmlhelp_cmd.py new file mode 100644 index 00000000..a0f5e8ac --- /dev/null +++ b/test/Docbook/basedir/htmlhelp/htmlhelp_cmd.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the base_dir argument for the HTMLHELP builder while using +the xsltproc executable, if it exists. +""" + +import os +import sys +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not (xsltproc and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('No xsltproc or no stylesheets installed, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('output/index.html')) +test.must_exist(test.workpath('htmlhelp.hhp')) +test.must_exist(test.workpath('toc.hhc')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('output/index.html')) +test.must_not_exist(test.workpath('htmlhelp.hhp')) +test.must_not_exist(test.workpath('toc.hhc')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd b/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd new file mode 100644 index 00000000..8c7c9ca3 --- /dev/null +++ b/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtmlhelp('manual', xsl='htmlhelp.xsl', base_dir='output/') + diff --git a/test/Docbook/basedir/slideshtml/image/SConstruct.cmd b/test/Docbook/basedir/slideshtml/image/SConstruct.cmd new file mode 100644 index 00000000..297aeb59 --- /dev/null +++ b/test/Docbook/basedir/slideshtml/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookSlidesHtml('virt', xsl='slides.xsl', base_dir='output/') + diff --git a/test/Docbook/basedir/slideshtml/slideshtml.py b/test/Docbook/basedir/slideshtml/slideshtml.py index 505d36de..a2375e4a 100644 --- a/test/Docbook/basedir/slideshtml/slideshtml.py +++ b/test/Docbook/basedir/slideshtml/slideshtml.py @@ -26,10 +26,17 @@ Test the base_dir argument for the Slides HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('Wrong OS or no "slides" stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/basedir/slideshtml/slideshtml_cmd.py b/test/Docbook/basedir/slideshtml/slideshtml_cmd.py new file mode 100644 index 00000000..51ed6e4d --- /dev/null +++ b/test/Docbook/basedir/slideshtml/slideshtml_cmd.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the base_dir argument for the Slides HTML builder while using +the xsltproc executable, if it exists. +""" + +import os +import sys +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not (xsltproc and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('No xsltproc or no "slides" stylesheets installed, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('output/index.html')) +test.must_exist(test.workpath('output/toc.html')) +test.must_exist(test.workpath('output/foil01.html')) +test.must_exist(test.workpath('output/foilgroup01.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('output/index.html')) +test.must_not_exist(test.workpath('output/toc.html')) +test.must_not_exist(test.workpath('output/foil01.html')) +test.must_not_exist(test.workpath('output/foilgroup01.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/epub/epub.py b/test/Docbook/basic/epub/epub.py new file mode 100644 index 00000000..19e08a0a --- /dev/null +++ b/test/Docbook/basic/epub/epub.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the EPUB builder. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +try: + import libxml2 +except: + try: + import lxml + except: + test.skip_test('Cannot find installed Python binding for libxml2 or lxml, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(stderr=None) +test.must_exist(test.workpath('manual.epub')) +test.must_exist(test.workpath('OEBPS','toc.ncx')) +test.must_exist(test.workpath('OEBPS','content.opf')) +test.must_exist(test.workpath('META-INF','container.xml')) + +# Cleanup +test.run(arguments='-c') +test.must_not_exist(test.workpath('manual.epub')) +test.must_not_exist(test.workpath('OEBPS')) +test.must_not_exist(test.workpath('META-INF')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/epub/epub_cmd.py b/test/Docbook/basic/epub/epub_cmd.py new file mode 100644 index 00000000..b79d1859 --- /dev/null +++ b/test/Docbook/basic/epub/epub_cmd.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the EPUB builder while using +the xsltproc executable, if it exists. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('manual.epub')) +test.must_exist(test.workpath('OEBPS','toc.ncx')) +test.must_exist(test.workpath('OEBPS','content.opf')) +test.must_exist(test.workpath('META-INF','container.xml')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('manual.epub')) +test.must_not_exist(test.workpath('OEBPS')) +test.must_not_exist(test.workpath('META-INF')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/epub/image/SConstruct b/test/Docbook/basic/epub/image/SConstruct new file mode 100644 index 00000000..16a06996 --- /dev/null +++ b/test/Docbook/basic/epub/image/SConstruct @@ -0,0 +1,2 @@ +env = Environment(tools=['docbook']) +env.DocbookEpub('manual') diff --git a/test/Docbook/basic/epub/image/SConstruct.cmd b/test/Docbook/basic/epub/image/SConstruct.cmd new file mode 100644 index 00000000..27cf2c8f --- /dev/null +++ b/test/Docbook/basic/epub/image/SConstruct.cmd @@ -0,0 +1,2 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookEpub('manual') diff --git a/test/Docbook/basic/epub/image/manual.xml b/test/Docbook/basic/epub/image/manual.xml new file mode 100644 index 00000000..ca12e0ed --- /dev/null +++ b/test/Docbook/basic/epub/image/manual.xml @@ -0,0 +1,388 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright (c) 2001-2010 The SCons Foundation + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY + KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" +"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<article> + <title>The SCons qt4 tool</title> + + <articleinfo> + <author> + <surname>Dirk Baechle</surname> + </author> + + <pubdate>2010-12-06</pubdate> + </articleinfo> + + <section id="basics"> + <title>Basics</title> + + <para>This tool can be used to compile Qt projects, designed for versions + 4.x.y and higher. It is not usable for Qt3 and older versions, since some + of the helper tools (<literal>moc</literal>, <literal>uic</literal>) + behave different.</para> + + <section id="install"> + <title>Install</title> + + <para>Installing it, requires you to copy (or, even better: checkout) + the contents of the package's <literal>qt4</literal> folder to</para> + + <orderedlist> + <listitem> + <para><quote><literal>/path_to_your_project/site_scons/site_tools/qt4</literal></quote>, + if you need the Qt4 Tool in one project only, or</para> + </listitem> + + <listitem> + <para><quote><literal>~/.scons/site_scons/site_tools/qt4</literal></quote>, + for a system-wide installation under your current login.</para> + </listitem> + </orderedlist> + + <para>For more infos about this, please refer to</para> + + <itemizedlist> + <listitem> + <para>the SCons User's Guide, chap. 17.7 "Where to put your custom + Builders and Tools" and</para> + </listitem> + + <listitem> + <para>the SCons Tools Wiki page at <ulink + url="http://scons.org/wiki/ToolsIndex">http://scons.org/wiki/ToolsIndex</ulink>.</para> + </listitem> + </itemizedlist> + </section> + + <section id="activation"> + <title>How to activate</title> + + <para>For activating the tool "qt4", you have to add its name to the + Environment constructor, like this</para> + + <screen>env = Environment(tools=['default','qt4']) +</screen> + + <para>On its startup, the Qt4 tool tries to read the variable + <literal>QT4DIR</literal> from the current Environment and + <literal>os.environ</literal>. If it is not set, the value of + <literal>QTDIR</literal> (in Environment/<literal>os.environ</literal>) + is used as a fallback.</para> + + <para>So, you either have to explicitly give the path of your Qt4 + installation to the Environment with</para> + + <screen>env['QT4DIR'] = '/usr/local/Trolltech/Qt-4.2.3' +</screen> + + <para>or set the <literal>QT4DIR</literal> as environment variable in + your shell.</para> + </section> + + <section id="requirements"> + <title>Requirements</title> + + <para>Under Linux, "qt4" uses the system tool + <literal>pkg-config</literal> for automatically setting the required + compile and link flags of the single Qt4 modules (like QtCore, + QtGui,...). This means that</para> + + <orderedlist> + <listitem> + <para>you should have <literal>pkg-config</literal> installed, + and</para> + </listitem> + + <listitem> + <para>you additionally have to set + <literal>PKG_CONFIG_PATH</literal> in your shell environment, such + that it points to $<literal>QT4DIR/lib/pkgconfig</literal> (or + $<literal>QT4DIR/lib</literal> for some older versions).</para> + </listitem> + </orderedlist> + + <para>Based on these two environment variables + (<literal>QT4DIR</literal> and <literal>PKG_CONFIG_PATH</literal>), the + "qt4" tool initializes all <literal>QT4_*</literal> construction + variables listed in the Reference manual. This happens when the tool is + "detected" during Environment construction. As a consequence, the setup + of the tool gets a two-stage process, if you want to override the values + provided by your current shell settings:</para> + + <screen># Stage 1: create plain environment +qtEnv = Environment() +# Set new vars +qtEnv['QT4DIR'] = '/usr/local/Trolltech/Qt-4.2.3 +qtEnv['ENV']['PKG_CONFIG_PATH'] = '/usr/local/Trolltech/Qt-4.2.3/lib/pkgconfig' +# Stage 2: add qt4 tool +qtEnv.Tool('qt4') +</screen> + </section> + </section> + + <section id="boilerplate"> + <title>Suggested boilerplate</title> + + <para>Based on the requirements above, we suggest a simple ready-to-go + setup as follows:</para> + + <para>SConstruct</para> + + <screen># Detect Qt version +qtdir = detectLatestQtDir() + +# Create base environment +baseEnv = Environment() +#...further customization of base env + +# Clone Qt environment +qtEnv = baseEnv.Clone() +# Set QT4DIR and PKG_CONFIG_PATH +qtEnv['ENV']['PKG_CONFIG_PATH'] = os.path.join(qtdir, 'lib/pkgconfig') +qtEnv['QT4DIR'] = qtdir +# Add qt4 tool +qtEnv.Tool('qt4') +#...further customization of qt env + +# Export environments +Export('baseEnv qtEnv') + +# Your other stuff... +# ...including the call to your SConscripts +</screen> + + <para>In a SConscript</para> + + <screen># Get the Qt4 environment +Import('qtEnv') +# Clone it +env = qtEnv.clone() +# Patch it +env.Append(CCFLAGS=['-m32']) # or whatever +# Use it +env.StaticLibrary('foo', Glob('*.cpp')) +</screen> + + <para>The detection of the Qt directory could be as simple as directly + assigning a fixed path</para> + + <screen>def detectLatestQtDir(): + return "/usr/local/qt4.3.2" +</screen> + + <para>or a little more sophisticated</para> + + <screen># Tries to detect the path to the installation of Qt with +# the highest version number +def detectLatestQtDir(): + if sys.platform.startswith("linux"): + # Simple check: inspect only '/usr/local/Trolltech' + paths = glob.glob('/usr/local/Trolltech/*') + if len(paths): + paths.sort() + return paths[-1] + else: + return "" + else: + # Simple check: inspect only 'C:\Qt' + paths = glob.glob('C:\\Qt\\*') + if len(paths): + paths.sort() + return paths[-1] + else: + return os.environ.get("QTDIR","") +</screen> + </section> + + <section id="firstproject"> + <title>A first project</title> + + <para>The following SConscript is for a simple project with some cxx + files, using the QtCore, QtGui and QtNetwork modules:</para> + + <screen>Import('qtEnv') +env = qtEnv.Clone() +env.EnableQt4Modules([ + 'QtGui', + 'QtCore', + 'QtNetwork' + ]) +# Add your CCFLAGS and CPPPATHs to env here... + +env.Program('foo', Glob('*.cpp')) +</screen> + </section> + + <section id="mocup"> + <title>MOC it up</title> + + <para>For the basic support of automocing, nothing needs to be done by the + user. The tool usually detects the <literal>Q_OBJECT</literal> macro and + calls the <quote><literal>moc</literal></quote> executable + accordingly.</para> + + <para>If you don't want this, you can switch off the automocing by + a</para> + + <screen>env['QT4_AUTOSCAN'] = 0 +</screen> + + <para>in your SConscript file. Then, you have to moc your files + explicitly, using the Moc4 builder.</para> + + <para>You can also switch to an extended automoc strategy with</para> + + <screen>env['QT4_AUTOSCAN_STRATEGY'] = 1 +</screen> + + <para>Please read the description of the + <literal>QT4_AUTOSCAN_STRATEGY</literal> variable in the Reference manual + for details.</para> + + <para>For debugging purposes, you can set the variable + <literal>QT4_DEBUG</literal> with</para> + + <screen>env['QT4_DEBUG'] = 1 +</screen> + + <para>which outputs a lot of messages during automocing.</para> + </section> + + <section id="forms"> + <title>Forms (.ui)</title> + + <para>The header files with setup code for your GUI classes, are not + compiled automatically from your <literal>.ui</literal> files. You always + have to call the Uic4 builder explicitly like</para> + + <screen>env.Uic4(Glob('*.ui')) +env.Program('foo', Glob('*.cpp')) +</screen> + </section> + + <section id="resources"> + <title>Resource files (.qrc)</title> + + <para>Resource files are not built automatically, you always have to add + the names of the <literal>.qrc</literal> files to the source list for your + program or library:</para> + + <screen>env.Program('foo', Glob('*.cpp')+Glob('*.qrc')) +</screen> + + <para>For each of the Resource input files, its prefix defines the name of + the resulting resource. An appropriate + <quote><literal>-name</literal></quote> option is added to the call of the + <literal>rcc</literal> executable by default.</para> + + <para>You can also call the Qrc4 builder explicitly as</para> + + <screen>qrccc = env.Qrc4('foo') # ['foo.qrc'] -> ['qrc_foo.cc'] +</screen> + + <para>or (overriding the default suffix)</para> + + <screen>qrccc = env.Qrc4('myprefix_foo.cxx','foo.qrc') # -> ['qrc_myprefix_foo.cxx'] +</screen> + + <para>and then add the resulting cxx file to the sources of your + Program/Library:</para> + + <screen>env.Program('foo', Glob('*.cpp') + qrccc) +</screen> + </section> + + <section id="translation"> + <title>Translation files</title> + + <para>The update of the <literal>.ts</literal> files and the conversion to + binary <literal>.qm</literal> files is not done automatically. You have to + call the corresponding builders on your own.</para> + + <para>Example for updating a translation file:</para> + + <screen>env.Ts4('foo.ts','.') # -> ['foo.ts'] +</screen> + + <para>By default, the <literal>.ts</literal> files are treated as + <emphasis>precious</emphasis> targets. This means that they are not + removed prior to a rebuild, but simply get updated. Additionally, they do + not get cleaned on a <quote><literal>scons -c</literal></quote>. If you + want to delete the translation files on the + <quote><literal>-c</literal></quote> SCons command, you can set the + variable <quote><literal>QT4_CLEAN_TS</literal></quote> like this</para> + + <screen>env['QT4_CLEAN_TS']=1 +</screen> + + <para>Example for releasing a translation file, i.e. compiling it to a + <literal>.qm</literal> binary file:</para> + + <screen>env.Qm4('foo') # ['foo.ts'] -> ['foo.qm'] +</screen> + + <para>or (overriding the output prefix)</para> + + <screen>env.Qm4('myprefix','foo') # ['foo.ts'] -> ['myprefix.qm'] +</screen> + + <para>As an extension both, the Ts4() and Qm4 builder, support the + definition of multiple targets. So, calling</para> + + <screen>env.Ts4(['app_en','app_de'], Glob('*.cpp')) +</screen> + + <para>and</para> + + <screen>env.Qm4(['app','copy'], Glob('*.ts')) +</screen> + + <para>should work fine.</para> + + <para>Finally, two short notes about the support of directories for the + Ts4() builder. You can pass an arbitrary mix of cxx files and subdirs to + it, as in</para> + + <screen>env.Ts4('app_en',['sub1','appwindow.cpp','main.cpp'])) +</screen> + + <para>where <literal>sub1</literal> is a folder that gets scanned + recursively for cxx files by <literal>lupdate</literal>. But like this, + you lose all dependency information for the subdir, i.e. if a file inside + the folder changes, the .ts file is not updated automatically! In this + case you should tell SCons to always update the target:</para> + + <screen>ts = env.Ts4('app_en',['sub1','appwindow.cpp','main.cpp']) +env.AlwaysBuild(ts) +</screen> + + <para>Last note: specifying the current folder + <quote><literal>.</literal></quote> as input to Ts4() and storing the + resulting .ts file in the same directory, leads to a dependency cycle! You + then have to store the .ts and .qm files outside of the current folder, or + use <literal>Glob('*.cpp'))</literal> instead.</para> + </section> +</article> diff --git a/test/Docbook/basic/html/html_cmd.py b/test/Docbook/basic/html/html_cmd.py new file mode 100644 index 00000000..acb4dad9 --- /dev/null +++ b/test/Docbook/basic/html/html_cmd.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the HTML builder while using +the xsltproc executable, if it exists. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd']) +test.must_exist(test.workpath('manual.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('manual.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/html/image/SConstruct.cmd b/test/Docbook/basic/html/image/SConstruct.cmd new file mode 100644 index 00000000..20b4aa25 --- /dev/null +++ b/test/Docbook/basic/html/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtml('manual') + diff --git a/test/Docbook/basic/htmlchunked/htmlchunked_cmd.py b/test/Docbook/basic/htmlchunked/htmlchunked_cmd.py new file mode 100644 index 00000000..e1ad49a2 --- /dev/null +++ b/test/Docbook/basic/htmlchunked/htmlchunked_cmd.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the chunked HTML builder while using +the xsltproc executable, if it exists. +""" + +import os +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('index.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('index.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/htmlchunked/image/SConstruct.cmd b/test/Docbook/basic/htmlchunked/image/SConstruct.cmd new file mode 100644 index 00000000..e2406f29 --- /dev/null +++ b/test/Docbook/basic/htmlchunked/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtmlChunked('manual') + diff --git a/test/Docbook/basic/htmlhelp/htmlhelp_cmd.py b/test/Docbook/basic/htmlhelp/htmlhelp_cmd.py new file mode 100644 index 00000000..8e1c1b6b --- /dev/null +++ b/test/Docbook/basic/htmlhelp/htmlhelp_cmd.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the HTMLHELP builder while using +the xsltproc executable, if it exists. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('index.html')) +test.must_exist(test.workpath('htmlhelp.hhp')) +test.must_exist(test.workpath('toc.hhc')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('index.html')) +test.must_not_exist(test.workpath('htmlhelp.hhp')) +test.must_not_exist(test.workpath('toc.hhc')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/htmlhelp/image/SConstruct.cmd b/test/Docbook/basic/htmlhelp/image/SConstruct.cmd new file mode 100644 index 00000000..29fb4fa6 --- /dev/null +++ b/test/Docbook/basic/htmlhelp/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtmlhelp('manual') + diff --git a/test/Docbook/basic/man/image/SConstruct.cmd b/test/Docbook/basic/man/image/SConstruct.cmd new file mode 100644 index 00000000..8b1406b7 --- /dev/null +++ b/test/Docbook/basic/man/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookMan('refdb') + diff --git a/test/Docbook/basic/man/man_cmd.py b/test/Docbook/basic/man/man_cmd.py new file mode 100644 index 00000000..f5127e32 --- /dev/null +++ b/test/Docbook/basic/man/man_cmd.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the Man builder while using +the xsltproc executable, if it exists. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('refdb.8')) +test.must_exist(test.workpath('refdb.sh.8')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('refdb.8')) +test.must_not_exist(test.workpath('refdb.sh.8')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/slideshtml/image/SConstruct.cmd b/test/Docbook/basic/slideshtml/image/SConstruct.cmd new file mode 100644 index 00000000..133cb118 --- /dev/null +++ b/test/Docbook/basic/slideshtml/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookSlidesHtml('virt') + diff --git a/test/Docbook/basic/slideshtml/slideshtml.py b/test/Docbook/basic/slideshtml/slideshtml.py index d4636d4b..37c2be0c 100644 --- a/test/Docbook/basic/slideshtml/slideshtml.py +++ b/test/Docbook/basic/slideshtml/slideshtml.py @@ -26,10 +26,17 @@ Test the Slides HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('Wrong OS or no "slides" stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/basic/slideshtml/slideshtml_cmd.py b/test/Docbook/basic/slideshtml/slideshtml_cmd.py new file mode 100644 index 00000000..ce5c30ba --- /dev/null +++ b/test/Docbook/basic/slideshtml/slideshtml_cmd.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +""" +Test the Slides HTML builder while using +the xsltproc executable, if it exists. +""" + +import os +import sys +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not (xsltproc and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('No xsltproc executable or no "slides" stylesheets installed, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('index.html')) +test.must_exist(test.workpath('toc.html')) +test.must_exist(test.workpath('foil01.html')) +test.must_exist(test.workpath('foilgroup01.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('index.html')) +test.must_not_exist(test.workpath('toc.html')) +test.must_not_exist(test.workpath('foil01.html')) +test.must_not_exist(test.workpath('foilgroup01.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/rootname/htmlchunked/htmlchunked.py b/test/Docbook/rootname/htmlchunked/htmlchunked.py index 24890194..8ab91d2d 100644 --- a/test/Docbook/rootname/htmlchunked/htmlchunked.py +++ b/test/Docbook/rootname/htmlchunked/htmlchunked.py @@ -26,10 +26,16 @@ Test the root.name argument for the chunked HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('Wrong OS or no stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/rootname/htmlhelp/htmlhelp.py b/test/Docbook/rootname/htmlhelp/htmlhelp.py index 84be5d95..ee37e1a9 100644 --- a/test/Docbook/rootname/htmlhelp/htmlhelp.py +++ b/test/Docbook/rootname/htmlhelp/htmlhelp.py @@ -26,10 +26,16 @@ Test the root.name argument for the HTMLHELP builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('Wrong OS or no stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/rootname/slideshtml/slideshtml.py b/test/Docbook/rootname/slideshtml/slideshtml.py index c316adae..4d550358 100644 --- a/test/Docbook/rootname/slideshtml/slideshtml.py +++ b/test/Docbook/rootname/slideshtml/slideshtml.py @@ -26,10 +26,17 @@ Test the root.name argument for the Slides HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('Wrong OS or no "slides" stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Ghostscript/GS.py b/test/Ghostscript/GS.py index 2cae8b8d..daeea09e 100644 --- a/test/Ghostscript/GS.py +++ b/test/Ghostscript/GS.py @@ -51,6 +51,7 @@ env = Environment(GS = r'%(_python_)s mygs.py', GSCOM = r'$GS $TARGET $SOURCE', tools=['gs']) env.PDF(target = 'test1.pdf', source = 'test1.ps') +env.Gs(target = 'test2.pdf', source = 'test1.ps') """ % locals()) test.write('test1.ps', r"""This is a .ps test. @@ -60,6 +61,7 @@ test.write('test1.ps', r"""This is a .ps test. test.run(arguments = '.', stderr = None) test.fail_test(test.read('test1.pdf') != "This is a .ps test.\n") +test.fail_test(test.read('test2.pdf') != "This is a .ps test.\n") diff --git a/test/Interactive/version.py b/test/Interactive/version.py index bbca9efc..96ce51ed 100644 --- a/test/Interactive/version.py +++ b/test/Interactive/version.py @@ -36,15 +36,11 @@ test.write('SConstruct', "") -# Construct the standard copyright marker so it doesn't get replaced +# Standard copyright marker is mangled so it doesn't get replaced # by the packaging build. -copyright_marker = '__' + 'COPYRIGHT' + '__' - -fmt = '(%s|Copyright \\(c\\) %s The SCons Foundation)\n' - -copyright_line = fmt % (copyright_marker, TestSCons.copyright_years) - - +copyright_line = """\ +(_{2}COPYRIGHT__|Copyright \\(c\\) 2001[-\d, ]+ The SCons Foundation) +""" expect1 = """\ scons>>> diff --git a/test/option-v.py b/test/option-v.py index 680f5417..f3eb61ce 100644 --- a/test/option-v.py +++ b/test/option-v.py @@ -31,13 +31,11 @@ test = TestSCons.TestSCons(match = TestCmd.match_re) test.write('SConstruct', "") -# Construct the standard copyright marker so it doesn't get replaced +# Standard copyright marker is mangled so it doesn't get replaced # by the packaging build. -copyright_marker = '__' + 'COPYRIGHT' + '__' - -fmt = '(%s|Copyright \\(c\\) %s The SCons Foundation)\n' - -copyright_line = fmt % (copyright_marker, TestSCons.copyright_years) +copyright_line = """\ +(_{2}COPYRIGHT__|Copyright \\(c\\) 2001[-\d, ]+ The SCons Foundation) +""" # Windows may or may not print a line for the script version # depending on whether it's invoked through scons.py or scons.bat. |