diff options
author | Robert Managan <managan1@llnl.gov> | 2012-10-17 17:13:16 (GMT) |
---|---|---|
committer | Robert Managan <managan1@llnl.gov> | 2012-10-17 17:13:16 (GMT) |
commit | 297e7beb4b8e25762dce2d91b1545a5761f32517 (patch) | |
tree | c71e1e314502006ea619391f09f33f589bb70787 /src | |
parent | 54128aa8e74ffb6a8a708e58db210e47956adf48 (diff) | |
parent | e798100c16996b00c8761891e9462b60fb2350ec (diff) | |
download | SCons-297e7beb4b8e25762dce2d91b1545a5761f32517.zip SCons-297e7beb4b8e25762dce2d91b1545a5761f32517.tar.gz SCons-297e7beb4b8e25762dce2d91b1545a5761f32517.tar.bz2 |
merge in changes from other forks/branches
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 5 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 15 | ||||
-rw-r--r-- | src/engine/SCons/PathList.py | 10 | ||||
-rw-r--r-- | src/engine/SCons/PathListTests.py | 36 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msgfmt.py | 10 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msginit.py | 10 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msgmerge.py | 10 | ||||
-rw-r--r-- | src/engine/SCons/Tool/tex.py | 22 | ||||
-rw-r--r-- | src/engine/SCons/Tool/xgettext.py | 5 |
9 files changed, 108 insertions, 15 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c903ece..29cb6a3 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.X.X - + From Alexey Klimkin: + - Fix nested LIBPATH expansion by flattening sequences in subst_path. + From eyan on Bitbucket: - Print target name with command execution time with --debug=time @@ -37,6 +40,8 @@ RELEASE 2.X.X - From Rob Managan: - Updated the TeX builder to support the \newglossary command in LaTeX's glossaries package and the files it creates. + - Improve support for new versions of biblatex in the TeX builder + so biber is called automatically if biblatex requires it. RELEASE 2.2.0 - Mon, 05 Aug 2012 15:37:48 +0000 diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 9237c8a..45cf876 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1440,6 +1440,21 @@ def exists(env): x = s("${_concat(PRE, LIST, SUF, __env__)}") assert x == 'preasuf prebsuf', x + def test_concat_nested(self): + "Test _concat() on a nested substitution strings." + e = self.TestEnvironment(PRE='pre', SUF='suf', + L1=['a', 'b'], + L2=['c', 'd'], + L3=['$L2']) + x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)') + assert x == 'preasuf prebsuf', x + e.AppendUnique(L1 = ['$L2']) + x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)') + assert x == 'preasuf prebsuf precsuf predsuf', x + e.AppendUnique(L1 = ['$L3']) + x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)') + assert x == 'preasuf prebsuf precsuf predsuf precsuf predsuf', x + def test_gvars(self): """Test the Environment gvars() method""" env = self.TestEnvironment(XXX = 'x', YYY = 'y', ZZZ = 'z') diff --git a/src/engine/SCons/PathList.py b/src/engine/SCons/PathList.py index 870c195..f3de57c 100644 --- a/src/engine/SCons/PathList.py +++ b/src/engine/SCons/PathList.py @@ -131,12 +131,14 @@ class _PathList(object): value = env.subst(value, target=target, source=source, conv=node_conv) if SCons.Util.is_Sequence(value): - result.extend(value) - continue - + result.extend(SCons.Util.flatten(value)) + elif value: + result.append(value) elif type == TYPE_OBJECT: value = node_conv(value) - if value: + if value: + result.append(value) + elif value: result.append(value) return tuple(result) diff --git a/src/engine/SCons/PathListTests.py b/src/engine/SCons/PathListTests.py index 212c761..e83fc50 100644 --- a/src/engine/SCons/PathListTests.py +++ b/src/engine/SCons/PathListTests.py @@ -48,6 +48,8 @@ class subst_pathTestCase(unittest.TestCase): return s self.env = FakeEnvironment(AAA = 'aaa', NULL = '') + from SCons.Environment import Environment + self.env = Environment(AAA = 'aaa', NULL = '') def test_node(self): """Test the subst_path() method on a Node @@ -120,6 +122,40 @@ class subst_pathTestCase(unittest.TestCase): assert result == ('aaa',), result + def test_list_of_lists(self): + """Test the subst_path() method on substitution of nested lists. + """ + pl = SCons.PathList.PathList((['$AAA', '$AAA'], '$NULL')) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('aaa', 'aaa'), result + + def test_subst_nested(self): + """Test the subst_path() method on nested substitution of strings. + """ + self.env.Append(L1 = ['a', 'b'], + L2 = ['c', 'd'], + L3 = ['$L2']) + pl = SCons.PathList.PathList(['$L1']) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('a', 'b'), result + self.env.Append(L1 = ['$L2']) + pl = SCons.PathList.PathList(['$L1']) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('a', 'b', 'c', 'd'), result + self.env.Append(L1 = ['$L3']) + pl = SCons.PathList.PathList(['$L1']) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('a', 'b', 'c', 'd', 'c', 'd'), result + + def test_another_env(self): + """Test the subst_path does lazy evaluation. + """ + pl = SCons.PathList.PathList(('$AAA', '$NULL')) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('aaa',), result + e = self.env.Clone(AAA = 'bbb') + result = pl.subst_path(e, 'y', 'z') + assert result == ('bbb',), result class PathListCacheTestCase(unittest.TestCase): diff --git a/src/engine/SCons/Tool/msgfmt.py b/src/engine/SCons/Tool/msgfmt.py index 83b54f7..352ba77 100644 --- a/src/engine/SCons/Tool/msgfmt.py +++ b/src/engine/SCons/Tool/msgfmt.py @@ -77,7 +77,10 @@ def generate(env,**kw): """ Generate `msgfmt` tool """ import SCons.Util from SCons.Tool.GettextCommon import _detect_msgfmt - env['MSGFMT'] = _detect_msgfmt(env) + try: + env['MSGFMT'] = _detect_msgfmt(env) + except: + env['MSGFMT'] = 'msgfmt' env.SetDefault( MSGFMTFLAGS = [ SCons.Util.CLVar('-c') ], MSGFMTCOM = '$MSGFMT $MSGFMTFLAGS -o $TARGET $SOURCE', @@ -92,7 +95,10 @@ def generate(env,**kw): def exists(env): """ Check if the tool exists """ from SCons.Tool.GettextCommon import _msgfmt_exists - return _msgfmt_exists(env) + try: + return _msgfmt_exists(env) + except: + return False ############################################################################# # Local Variables: diff --git a/src/engine/SCons/Tool/msginit.py b/src/engine/SCons/Tool/msginit.py index 87b3eec..5e9c0e4 100644 --- a/src/engine/SCons/Tool/msginit.py +++ b/src/engine/SCons/Tool/msginit.py @@ -79,7 +79,10 @@ def generate(env,**kw): """ Generate the `msginit` tool """ import SCons.Util from SCons.Tool.GettextCommon import _detect_msginit - env['MSGINIT'] = _detect_msginit(env) + try: + env['MSGINIT'] = _detect_msginit(env) + except: + env['MSGINIT'] = 'msginit' msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ + ' $MSGINITFLAGS -i $SOURCE -o $TARGET' # NOTE: We set POTSUFFIX here, in case the 'xgettext' is not loaded @@ -104,7 +107,10 @@ def generate(env,**kw): def exists(env): """ Check if the tool exists """ from SCons.Tool.GettextCommon import _msginit_exists - return _msginit_exists(env) + try: + return _msginit_exists(env) + except: + return False ############################################################################# # Local Variables: diff --git a/src/engine/SCons/Tool/msgmerge.py b/src/engine/SCons/Tool/msgmerge.py index 78eb2c5..f3710ab 100644 --- a/src/engine/SCons/Tool/msgmerge.py +++ b/src/engine/SCons/Tool/msgmerge.py @@ -70,7 +70,10 @@ def _POUpdateBuilderWrapper(env, target=None, source=_null, **kw): def generate(env,**kw): """ Generate the `xgettext` tool """ from SCons.Tool.GettextCommon import _detect_msgmerge - env['MSGMERGE'] = _detect_msgmerge(env) + try: + env['MSGMERGE'] = _detect_msgmerge(env) + except: + env['MSGMERGE'] = 'msgmerge' env.SetDefault( POTSUFFIX = ['.pot'], POSUFFIX = ['.po'], @@ -88,7 +91,10 @@ def generate(env,**kw): def exists(env): """ Check if the tool exists """ from SCons.Tool.GettextCommon import _msgmerge_exists - return _msgmerge_exists(env) + try: + return _msgmerge_exists(env) + except: + return False ############################################################################# # Local Variables: diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 0695755..5f24df0 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -129,6 +129,9 @@ LaTeXAction = None # An action to run BibTeX on a file. BibTeXAction = None +# An action to run Biber on a file. +BiberAction = None + # An action to run MakeIndex on a file. MakeIndexAction = None @@ -344,7 +347,9 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None must_rerun_latex = True # Now decide if biber will need to be run. - # The information that bibtex reads from the .bcf file is + # When the backend for biblatex is biber (by choice or default) the + # citation information is put in the .bcf file. + # The information that biber reads from the .bcf 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 once @@ -357,11 +362,11 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None content = open(target_bcf, "rb").read() if content.find("bibdata") != -1: if Verbose: - print "Need to run bibtex on ",bcffilename + print "Need to run biber on ",bcffilename bibfile = env.fs.File(SCons.Util.splitext(target_bcf)[0]) - result = BibTeXAction(bibfile, bibfile, env) + result = BiberAction(bibfile, bibfile, env) if result != 0: - check_file_error_message(env['BIBTEX'], 'blg') + check_file_error_message(env['BIBER'], 'blg') must_rerun_latex = True # Now decide if latex will need to be run again due to index. @@ -880,6 +885,11 @@ def generate_common(env): if BibTeXAction is None: BibTeXAction = SCons.Action.Action("$BIBTEXCOM", "$BIBTEXCOMSTR") + # Define an action to run Biber on a file. + global BiberAction + if BiberAction is None: + BiberAction = SCons.Action.Action("$BIBERCOM", "$BIBERCOMSTR") + # Define an action to run MakeIndex on a file. global MakeIndexAction if MakeIndexAction is None: @@ -939,6 +949,10 @@ def generate_common(env): env['BIBTEXFLAGS'] = SCons.Util.CLVar('') env['BIBTEXCOM'] = CDCOM + '${TARGET.dir} && $BIBTEX $BIBTEXFLAGS ${SOURCE.filebase}' + env['BIBER'] = 'biber' + env['BIBERFLAGS'] = SCons.Util.CLVar('') + env['BIBERCOM'] = CDCOM + '${TARGET.dir} && $BIBER $BIBERFLAGS ${SOURCE.filebase}' + env['MAKEINDEX'] = 'makeindex' env['MAKEINDEXFLAGS'] = SCons.Util.CLVar('') env['MAKEINDEXCOM'] = CDCOM + '${TARGET.dir} && $MAKEINDEX $MAKEINDEXFLAGS ${SOURCE.file}' diff --git a/src/engine/SCons/Tool/xgettext.py b/src/engine/SCons/Tool/xgettext.py index 17e055f..64436b8 100644 --- a/src/engine/SCons/Tool/xgettext.py +++ b/src/engine/SCons/Tool/xgettext.py @@ -271,7 +271,10 @@ def generate(env,**kw): import SCons.Util from SCons.Tool.GettextCommon import RPaths, _detect_xgettext - env['XGETTEXT'] = _detect_xgettext(env) + try: + env['XGETTEXT'] = _detect_xgettext(env) + except: + env['XGETTEXT'] = 'xgettext' # NOTE: sources="$SOURCES" would work as well. However, we use following # construction to convert absolute paths provided by scons onto paths # relative to current working dir. Note, that scons expands $SOURCE(S) to |