diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2012-04-07 19:03:57 -0400 |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2012-04-07 19:03:57 -0400 |
commit | b77237331643b82eea7365372379f56e5b494b24 (patch) | |
tree | a068e53380c92bfe47afeb39d217c4fe93c68970 | |
parent | 688a4aac959f6b481bf77cb2278b1accbfe24b14 (diff) | |
parent | f25c4b4c536ee8bc380165563c79a0e0f2cbded4 (diff) | |
download | scons-b77237331643b82eea7365372379f56e5b494b24.tar.gz |
Merged in garyo/scons (pull request #18)
-rw-r--r-- | QMTest/TestSCons.py | 2 | ||||
-rw-r--r-- | QMTest/TestSConsMSVS.py | 4 | ||||
-rw-r--r-- | SConstruct | 2 | ||||
-rw-r--r-- | bin/scons-doc.py | 2 | ||||
-rw-r--r-- | bin/scons-proc.py | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | bootstrap.py | 23 | ||||
-rw-r--r-- | doc/user/add-method.in | 2 | ||||
-rw-r--r-- | doc/user/add-method.xml | 2 | ||||
-rw-r--r-- | doc/user/builders-writing.in | 6 | ||||
-rw-r--r-- | doc/user/builders-writing.xml | 6 | ||||
-rw-r--r-- | doc/user/command-line.in | 30 | ||||
-rw-r--r-- | doc/user/command-line.xml | 30 | ||||
-rw-r--r-- | doc/user/depends.in | 6 | ||||
-rw-r--r-- | doc/user/depends.xml | 6 | ||||
-rw-r--r-- | doc/user/environments.in | 4 | ||||
-rw-r--r-- | doc/user/environments.xml | 4 | ||||
-rw-r--r-- | src/CHANGES.txt | 6 | ||||
-rw-r--r-- | src/engine/SCons/Action.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Conftest.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/SConfTests.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvs.py | 66 | ||||
-rw-r--r-- | src/engine/SCons/Tool/tex.py | 38 | ||||
-rw-r--r-- | test/TEX/multibib.py | 97 | ||||
-rw-r--r-- | test/update-release-info/update-release-info.py | 26 |
24 files changed, 263 insertions, 109 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 27cfcb89..4f04a486 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -33,7 +33,7 @@ from TestCommon import __all__ default_version = '2.1.0.alpha.yyyymmdd' -copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011' +copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012' python_version_unsupported = (2, 3, 0) python_version_deprecated = (2, 4, 0) diff --git a/QMTest/TestSConsMSVS.py b/QMTest/TestSConsMSVS.py index 604f1915..1cff81d6 100644 --- a/QMTest/TestSConsMSVS.py +++ b/QMTest/TestSConsMSVS.py @@ -710,7 +710,7 @@ expected_vcprojfile_10_0 = """\ \t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> \t</PropertyGroup> \t<ItemGroup> -\t\t<ClInclude Include="sdk.h" /> +\t\t<ClInclude Include="sdk_dir\sdk.h" /> \t</ItemGroup> \t<ItemGroup> \t\t<ClInclude Include="test.h" /> @@ -787,7 +787,7 @@ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='10.0', HOST_ARCH='%(HOST_ARCH)s') testsrc = ['test1.cpp', 'test2.cpp'] -testincs = ['sdk.h'] +testincs = ['sdk_dir\sdk.h'] testlocalincs = ['test.h'] testresources = ['test.rc'] testmisc = ['readme.txt'] @@ -5,7 +5,7 @@ # 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' +copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012' # This gets inserted into the man pages to reflect the month of release. month_year = 'MONTH YEAR' diff --git a/bin/scons-doc.py b/bin/scons-doc.py index f99dfa74..cf5d5b29 100644 --- a/bin/scons-doc.py +++ b/bin/scons-doc.py @@ -845,7 +845,7 @@ def process(filename, fout=sys.stdout): if data.startswith('<?xml '): first_line, data = data.split('\n', 1) - sys.stdout.write(first_line + '\n') + fout.write(first_line + '\n') x = MySGML(fout) for c in data: diff --git a/bin/scons-proc.py b/bin/scons-proc.py index 6d158165..1f537c71 100644 --- a/bin/scons-proc.py +++ b/bin/scons-proc.py @@ -17,7 +17,7 @@ import string import sys import xml.sax try: - from io import StringIO + from io import StringIO # usable as of 2.6; takes unicode only except ImportError: # No 'io' module or no StringIO in io exec('from cStringIO import StringIO') @@ -105,7 +105,7 @@ for f in args: content = content.replace('-->\n', '-->') input = xml_preamble + content + xml_postamble try: - saxparser.parse(StringIO(input)) + saxparser.parse(StringIO(unicode(input))) except: sys.stderr.write("error in %s\n" % f) raise diff --git a/bootstrap.py b/bootstrap.py index 2656f4fa..0d1a3fc5 100644..100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # # __COPYRIGHT__ # @@ -28,15 +29,15 @@ import subprocess __doc__ = """bootstrap.py -This script supports "bootstrap" execution of the current SCons in -this local source tree by copying of all necessary Python scripts and -modules from underneath the src/ subdirectory into a subdirectory (named -"bootstrap/" by default), and then executing the copied SCons with the -supplied command-line arguments. +Execute SCons from this source tree. It copies Python scripts and modules +from src/ subdirectory into a subdirectory named "bootstrap/" (by default), +and executes SCons from there with the supplied command-line arguments. -There are a handful of options that are specific to this bootstrap.py -script and which are *not* passed on to the underlying SCons script. -All of these begin with the string "bootstrap_": +This is a minimal build of SCons to bootstrap the full build of all the +packages, as specified in our local SConstruct file. + +Some options are specific to this bootstrap.py script and are *not* passed +on to the SCons script. All of these begin with the string "bootstrap_": --bootstrap_dir=DIR @@ -59,7 +60,7 @@ All of these begin with the string "bootstrap_": Only updates the bootstrap subdirectory, and then exits. -In addition to the above options, the bootstrap.py script understands +In addition to the above, the bootstrap.py script understands the following SCons options: -C, --directory @@ -68,10 +69,6 @@ the following SCons options: Because we change directory right away to the specified directory, the SCons script itself doesn't need to, so this option gets "eaten" by the bootstrap.py script. - -This is essentially a minimal build of SCons to bootstrap ourselves into -executing it for the full build of all the packages, as specified in our -local SConstruct file. """ script_dir = os.path.abspath(os.path.dirname(__file__)) diff --git a/doc/user/add-method.in b/doc/user/add-method.in index 7efd9235..2deb07a0 100644 --- a/doc/user/add-method.in +++ b/doc/user/add-method.in @@ -65,7 +65,7 @@ <para> - As mentioned, a psuedo-builder also provides more flexibility + As mentioned, a pseudo-builder also provides more flexibility in parsing arguments than you can get with a &Builder;. The next example shows a pseudo-builder with a named argument that modifies the filename, and a separate argument diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index 51bc04b9..3aac7a8d 100644 --- a/doc/user/add-method.xml +++ b/doc/user/add-method.xml @@ -64,7 +64,7 @@ <para> - As mentioned, a psuedo-builder also provides more flexibility + As mentioned, a pseudo-builder also provides more flexibility in parsing arguments than you can get with a &Builder;. The next example shows a pseudo-builder with a named argument that modifies the filename, and a separate argument diff --git a/doc/user/builders-writing.in b/doc/user/builders-writing.in index 93a183c3..749a8ba1 100644 --- a/doc/user/builders-writing.in +++ b/doc/user/builders-writing.in @@ -98,8 +98,8 @@ This functionality could be invoked as in the following example: <para> Although &SCons; provides many useful methods - for building common software products: - programs, libraries, documents. + for building common software products + (programs, libraries, documents, etc.), you frequently want to be able to build some other type of file not supported directly by &SCons;. @@ -109,7 +109,7 @@ This functionality could be invoked as in the following example: (In fact, the &SCons; interfaces for creating &Builder; objects are flexible enough and easy enough to use that all of the the &SCons; built-in &Builder; objects - are created the mechanisms described in this section.) + are created using the mechanisms described in this section.) </para> diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml index c8ff0036..f42a61f5 100644 --- a/doc/user/builders-writing.xml +++ b/doc/user/builders-writing.xml @@ -98,8 +98,8 @@ This functionality could be invoked as in the following example: <para> Although &SCons; provides many useful methods - for building common software products: - programs, libraries, documents. + for building common software products + (programs, libraries, documents, etc.), you frequently want to be able to build some other type of file not supported directly by &SCons;. @@ -109,7 +109,7 @@ This functionality could be invoked as in the following example: (In fact, the &SCons; interfaces for creating &Builder; objects are flexible enough and easy enough to use that all of the the &SCons; built-in &Builder; objects - are created the mechanisms described in this section.) + are created using the mechanisms described in this section.) </para> diff --git a/doc/user/command-line.in b/doc/user/command-line.in index abf8953c..33f88ec4 100644 --- a/doc/user/command-line.in +++ b/doc/user/command-line.in @@ -62,7 +62,7 @@ Any command-line argument containing an <literal>=</literal> (equal sign) is considered a variable setting with the form - <varname>variable</varname>=<varname>value</varname> + <varname>variable</varname>=<varname>value</varname>. &SCons; provides direct access to all of the command-line variable settings, the ability to apply command-line variable settings @@ -885,7 +885,7 @@ <scons_example name="Variables1"> <file name="SConstruct" printme="1"> - vars = Variables() + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars, CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) @@ -902,8 +902,9 @@ <para> This &SConstruct; file first creates a &Variables; object - (the <literal>vars = Variables()</literal> call), - and then uses the object's &Add; + which uses the values from the command-line options dictionary &ARGUMENTS; + (the <literal>vars = Variables(None, ARGUMENTS)</literal> call). + It then uses the object's &Add; method to indicate that the &RELEASE; variable can be set on the command line, and that its default value will be <literal>0</literal> @@ -942,7 +943,7 @@ &PathOption;, &PackageOption; and &AddOptions;. These older names still work, and you may encounter them in older - &SConscript; fles, + &SConscript; files, but they have been officially deprecated as of &SCons; version 2.0. @@ -975,7 +976,7 @@ <scons_example name="Variables_Help"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars) Help(vars.GenerateHelpText(env)) @@ -1098,6 +1099,23 @@ <scons_output_command>scons -Q</scons_output_command> </scons_output> + <para> + + Finally, you can combine both methods with: + + </para> + + <screen> + vars = Variables('custom.py', ARGUMENTS) + </screen> + + <para> + + where values in the option file &custom_py; get overwritten + by the ones specified on the command line. + + </para> + </section> <section> diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index 1bb84e26..1006c6b3 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -62,7 +62,7 @@ Any command-line argument containing an <literal>=</literal> (equal sign) is considered a variable setting with the form - <varname>variable</varname>=<varname>value</varname> + <varname>variable</varname>=<varname>value</varname>. &SCons; provides direct access to all of the command-line variable settings, the ability to apply command-line variable settings @@ -875,7 +875,7 @@ </para> <programlisting> - vars = Variables() + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars, CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) @@ -885,8 +885,9 @@ <para> This &SConstruct; file first creates a &Variables; object - (the <literal>vars = Variables()</literal> call), - and then uses the object's &Add; + which uses the values from the command-line options dictionary &ARGUMENTS; + (the <literal>vars = Variables(None, ARGUMENTS)</literal> call). + It then uses the object's &Add; method to indicate that the &RELEASE; variable can be set on the command line, and that its default value will be <literal>0</literal> @@ -928,7 +929,7 @@ &PathOption;, &PackageOption; and &AddOptions;. These older names still work, and you may encounter them in older - &SConscript; fles, + &SConscript; files, but they have been officially deprecated as of &SCons; version 2.0. @@ -960,7 +961,7 @@ </para> <programlisting> - vars = Variables('custom.py') + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars) Help(vars.GenerateHelpText(env)) @@ -1069,6 +1070,23 @@ cc -o foo foo.o bar.o </screen> + <para> + + Finally, you can combine both methods with: + + </para> + + <screen> + vars = Variables('custom.py', ARGUMENTS) + </screen> + + <para> + + where values in the option file &custom_py; get overwritten + by the ones specified on the command line. + + </para> + </section> <section> diff --git a/doc/user/depends.in b/doc/user/depends.in index 88828fec..f6013124 100644 --- a/doc/user/depends.in +++ b/doc/user/depends.in @@ -593,11 +593,11 @@ <para> - Another thing to look out for, is the fact that the three + Another thing to look out for is the fact that the three attributes above may not be present at the time of the first run. - Without any prior build, no targets got created and no + Without any prior build, no targets have been created and no <filename>.sconsign</filename> DB file exists yet. - So, it is recommended to always check whether the + So, you should always check whether the <varname>prev_ni</varname> attribute in question is available. </para> diff --git a/doc/user/depends.xml b/doc/user/depends.xml index a5e84d6d..df2a9115 100644 --- a/doc/user/depends.xml +++ b/doc/user/depends.xml @@ -589,11 +589,11 @@ <para> - Another thing to look out for, is the fact that the three + Another thing to look out for is the fact that the three attributes above may not be present at the time of the first run. - Without any prior build, no targets got created and no + Without any prior build, no targets have been created and no <filename>.sconsign</filename> DB file exists yet. - So, it is recommended to always check whether the + So, you should always check whether the <varname>prev_ni</varname> attribute in question is available. </para> diff --git a/doc/user/environments.in b/doc/user/environments.in index f7676760..9f393477 100644 --- a/doc/user/environments.in +++ b/doc/user/environments.in @@ -684,7 +684,7 @@ environment, of directory names, suffixes, etc. <para> Another way to get information from - a construction environment. + a construction environment is to use the &subst; method on a string containing <literal>$</literal> expansions of construction variable names. @@ -874,7 +874,7 @@ environment, of directory names, suffixes, etc. <para> You can, however, control the settings - in the default contstruction environment + in the default construction environment by using the &DefaultEnvironment; function to initialize various settings: diff --git a/doc/user/environments.xml b/doc/user/environments.xml index b2a85058..eaf4ba35 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -684,7 +684,7 @@ environment, of directory names, suffixes, etc. <para> Another way to get information from - a construction environment. + a construction environment is to use the &subst; method on a string containing <literal>$</literal> expansions of construction variable names. @@ -875,7 +875,7 @@ environment, of directory names, suffixes, etc. <para> You can, however, control the settings - in the default contstruction environment + in the default construction environment by using the &DefaultEnvironment; function to initialize various settings: diff --git a/src/CHANGES.txt b/src/CHANGES.txt index fbe4f250..fada1b7e 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -4,6 +4,12 @@ Change Log +RELEASE 2.X.X - + + From Rob Managan: + + - Updated the TeX builder to support LaTeX's multibib package. + RELEASE 2.1.0 - Mon, 09 Sep 2011 20:54:57 -0700 diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 6909a9ac..c1eef756 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -899,7 +899,7 @@ class CommandGeneratorAction(ActionBase): show=_null, execute=_null, chdir=_null, executor=None): act = self._generate(target, source, env, 0, executor) if act is None: - raise UserError("While building `%s': " + raise SCons.Errors.UserError("While building `%s': " "Cannot deduce file extension from source files: %s" % (repr(list(map(str, target))), repr(list(map(str, source))))) return act(target, source, env, exitstatfunc, presub, diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index 04a6bc2a..d4662780 100644 --- a/src/engine/SCons/Conftest.py +++ b/src/engine/SCons/Conftest.py @@ -554,7 +554,7 @@ def CheckDeclaration(context, symbol, includes = None, language = None): lang, suffix, msg = _lang2suffix(language) if msg: - context.Display("Cannot check for declaration %s: %s\n" % (type_name, msg)) + context.Display("Cannot check for declaration %s: %s\n" % (symbol, msg)) return msg src = includetext + includes diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index b05c4cc8..e6048860 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -697,6 +697,8 @@ int main() { assert r, "__cplusplus not declared in C++ ??" r = sconf.CheckDeclaration('__cplusplus', language = 'C') assert not r, "__cplusplus declared in C ??" + r = sconf.CheckDeclaration('unknown', language = 'Unknown') + assert not r, "unknown language was supported ??" finally: sconf.Finish() diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 6c273a7d..40773247 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -786,19 +786,15 @@ class _GenerateV7DSP(_DSPGenerator): # First remove any common prefix commonprefix = None - if len(sources) > 1: - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - elif len(sources) == 1: - commonprefix = os.path.dirname( sources[0] ) - sources[0] = os.path.basename( sources[0] ) + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp hierarchy = makeHierarchy(sources) self.printSources(hierarchy, commonprefix=commonprefix) @@ -1116,19 +1112,15 @@ class _GenerateV10DSP(_DSPGenerator): # First remove any common prefix sources = self.sources[kind] commonprefix = None - if len(sources) > 1: - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - elif len(sources) == 1: - commonprefix = os.path.dirname( sources[0] ) - sources[0] = os.path.basename( sources[0] ) + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp hierarchy = makeHierarchy(sources) self.printFilters(hierarchy, kind) @@ -1143,19 +1135,15 @@ class _GenerateV10DSP(_DSPGenerator): # First remove any common prefix sources = self.sources[kind] commonprefix = None - if len(sources) > 1: - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - elif len(sources) == 1: - commonprefix = os.path.dirname( sources[0] ) - sources[0] = os.path.basename( sources[0] ) + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp hierarchy = makeHierarchy(sources) self.printSources(hierarchy, kind, commonprefix, kind) diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index b0c518ee..0d871ad9 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -86,6 +86,7 @@ tableofcontents_re = re.compile(r"^[^%\n]*\\tableofcontents", re.MULTILINE) makeindex_re = re.compile(r"^[^%\n]*\\makeindex", re.MULTILINE) bibliography_re = re.compile(r"^[^%\n]*\\bibliography", re.MULTILINE) bibunit_re = re.compile(r"^[^%\n]*\\begin\{bibunit\}", re.MULTILINE) +multibib_re = re.compile(r"^[^%\n]*\\newcites\{([^\}]*)\}", re.MULTILINE) listoffigures_re = re.compile(r"^[^%\n]*\\listoffigures", re.MULTILINE) listoftables_re = re.compile(r"^[^%\n]*\\listoftables", re.MULTILINE) hyperref_re = re.compile(r"^[^%\n]*\\usepackage.*\{hyperref\}", re.MULTILINE) @@ -236,6 +237,9 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None must_rerun_latex = True + # .aux files already processed by BibTex + already_bibtexed = [] + # # routine to update MD5 hash and compare # @@ -298,21 +302,23 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None # The information that bibtex reads from the .aux file is # pass-independent. If we find (below) that the .bbl file is unchanged, # then the last latex saw a correct bibliography. - # Therefore only do this on the first pass - if count == 1: - for auxfilename in auxfiles: + # Therefore only do this once + # Go through all .aux files and remember the files already done. + for auxfilename in auxfiles: + if auxfilename not in already_bibtexed: + already_bibtexed.append(auxfilename) target_aux = os.path.join(targetdir, auxfilename) if os.path.isfile(target_aux): content = open(target_aux, "rb").read() if content.find("bibdata") != -1: if Verbose: - print "Need to run bibtex" + print "Need to run bibtex on ",auxfilename bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0]) result = BibTeXAction(bibfile, bibfile, env) if result != 0: check_file_error_message(env['BIBTEX'], 'blg') - must_rerun_latex = must_rerun_latex or check_MD5(suffix_nodes['.bbl'],'.bbl') - + #must_rerun_latex = must_rerun_latex or check_MD5(suffix_nodes['.bbl'],'.bbl') + must_rerun_latex = True # Now decide if latex will need to be run again due to index. if check_MD5(suffix_nodes['.idx'],'.idx') or (count == 1 and run_makeindex): # We must run makeindex @@ -553,6 +559,8 @@ def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphi for i in range(len(file_tests_search)): if file_tests[i][0] is None: file_tests[i][0] = file_tests_search[i].search(content) + if Verbose and file_tests[i][0]: + print " found match for ",file_tests[i][-1][-1] incResult = includeOnly_re.search(content) if incResult: @@ -621,6 +629,7 @@ def tex_emitter_core(target, source, env, graphics_extensions): makeindex_re, bibliography_re, bibunit_re, + multibib_re, tableofcontents_re, listoffigures_re, listoftables_re, @@ -636,6 +645,7 @@ def tex_emitter_core(target, source, env, graphics_extensions): ['.idx', '.ind', '.ilg','makeindex'], ['.bbl', '.blg','bibliography'], ['.bbl', '.blg','bibunit'], + ['.bbl', '.blg','multibib'], ['.toc','contents'], ['.lof','figures'], ['.lot','tables'], @@ -678,6 +688,8 @@ def tex_emitter_core(target, source, env, graphics_extensions): for (theSearch,suffix_list) in file_tests: # add side effects if feature is present.If file is to be generated,add all side effects + if Verbose and theSearch: + print "check side effects for ",suffix_list[-1] if (theSearch != None) or (not source[0].exists() ): file_list = [targetbase,] # for bibunit we need a list of files @@ -687,6 +699,18 @@ def tex_emitter_core(target, source, env, graphics_extensions): # remove the suffix '.aux' for i in range(len(file_list)): file_list[i] = SCons.Util.splitext(file_list[i])[0] + # for multibib we need a list of files + if suffix_list[-1] == 'multibib': + file_list = [] + for multibibmatch in multibib_re.finditer(content): + if Verbose: + print "multibib match ",multibibmatch.group(1) + if multibibmatch != None: + baselist = multibibmatch.group(1).split(',') + if Verbose: + print "multibib list ", baselist + for i in range(len(baselist)): + file_list.append(os.path.join(targetdir, baselist[i])) # now define the side effects for file_name in file_list: for suffix in suffix_list[:-1]: @@ -826,7 +850,7 @@ def generate_common(env): env['LATEX'] = 'latex' env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['LATEXCOM'] = CDCOM + '${TARGET.dir} && $LATEX $LATEXFLAGS ${SOURCE.file}' - env['LATEXRETRIES'] = 3 + env['LATEXRETRIES'] = 4 env['PDFLATEX'] = 'pdflatex' env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') diff --git a/test/TEX/multibib.py b/test/TEX/multibib.py new file mode 100644 index 00000000..8486e15b --- /dev/null +++ b/test/TEX/multibib.py @@ -0,0 +1,97 @@ +#!/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__" + +""" +Test creation of a Tex document that uses the multibib oackage + +Test courtesy Rob Managan. +""" + +import TestSCons +import os + +test = TestSCons.TestSCons() + +latex = test.where_is('latex') +if not latex: + test.skip_test("Could not find 'latex'; skipping test.\n") + +test.subdir(['src']) + + +test.write(['SConstruct'], """\ +import os + +env = Environment() + +DVI('multibib.tex') +""") + + +test.write(['lit.bib'],r""" +@book{Knuth:1991, author = {Knuth, Donald E.}, title = {The TEX book}, publisher = {Addison-Wesley, Reading, Massachusetts}, year = {1991}} +@book{Lamport:1994, author = {Lamport, Leslie}, title = {LATEX: A Document Preparation System}, publisher = {Addison-Wesley, Reading, Massachusetts, 2 edition}, year = {1994} } +@book{Adobe:1985, author = {Adobe System Incorporated}, title = {Postscript Language Tutorial and Cookbook}, publisher = {Addison-Wesley, Reading, Massachusetts}, year = {1985}} + +""") + +test.write(['multibib.tex'],r""" +\documentclass{article} +\usepackage{multibib} +\newcites{ltex}{\TeX\ and \LaTeX\ References} +\begin{document} +References to the \TeX book \citeltex{Knuth:1991} and to Lamport's \LaTeX\ book, which appears only in the references\nociteltex{Lamport:1994}. Finally a cite to a Postscript tutorial \cite{Adobe:1985}. +\bibliographystyleltex{alpha} +\bibliographyltex{lit} +\renewcommand{\refname}{Postscript References} +\bibliographystyle{plain} +\bibliography{lit} +\end{document} +""") + + +test.run(arguments = '', stderr=None) + + +# All (?) the files we expect will get created in the docs directory +files = [ + 'ltex.aux', + 'ltex.bbl', + 'ltex.blg', + 'multibib.aux', + 'multibib.bbl', + 'multibib.blg', + 'multibib.fls', + 'multibib.log', + 'multibib.dvi', +] + +for f in files: + test.must_exist([ f]) + +#test.must_not_exist(['docs/Fig1.pdf',]) + +test.pass_test() diff --git a/test/update-release-info/update-release-info.py b/test/update-release-info/update-release-info.py index dfcd2368..654a25c1 100644 --- a/test/update-release-info/update-release-info.py +++ b/test/update-release-info/update-release-info.py @@ -31,6 +31,9 @@ import os, sys, time import TestRuntest +# Needed to ensure we're using the correct year +this_year=time.localtime()[0] + TestSCons = 'QMTest/TestSCons.py' .split('/') README = 'README' .split('/') ReleaseConfig = 'ReleaseConfig' .split('/') @@ -69,14 +72,14 @@ combo_strings = [ """version_tuple = (2, 0, 0, 'final', 0) """, # Index 5: bad release date -"""release_date = (2011, 12) -""", +"""release_date = (%d, 12) +"""%this_year, # Index 6: release date (hhhh, mm, dd) -"""release_date = (2011, 12, 21) -""", +"""release_date = (%d, 12, 21) +"""%this_year, # Index 7: release date (hhhh, mm, dd, hh, mm, ss) -"""release_date = (2011, 12, 21, 12, 21, 12) -""", +"""release_date = (%d, 12, 21, 12, 21, 12) +"""%this_year, ] combo_error = \ @@ -114,8 +117,8 @@ combo_fail(0, 1, 2, stdout = combo_strings[0] = combo_strings[1] + combo_strings[2] + combo_strings[3] combo_fail(0, 5, stdout = -"""ERROR: Invalid release date (2011, 12) -""") +"""ERROR: Invalid release date (%d, 12) +"""%this_year ) def pave(path): path = path[:-1] @@ -195,7 +198,8 @@ test.must_match(Announce, """ RELEASE 2.0.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE """, mode = 'r') -years = ', '.join(map(str, range(2001, time.localtime()[0] + 1))) + +years = ', '.join(map(str, range(2001, this_year + 1))) test.must_match(SConstruct, """ month_year = 'MONTH YEAR' copyright_years = %s @@ -213,11 +217,11 @@ These files are a part of 33.22.11: # should get Python floors from TestSCons module. test.must_match(TestSCons, """ -copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011' +copyright_years = '%s' default_version = '2.0.0.alpha.yyyymmdd' python_version_unsupported = (2, 3) python_version_deprecated = (2, 4) -""", mode = 'r') +"""%years, mode = 'r') # should get Python floors from TestSCons module. test.must_match(Main, """ |