diff options
author | ptomulik <ptomulik@meil.pw.edu.pl> | 2012-06-06 23:03:25 (GMT) |
---|---|---|
committer | ptomulik <ptomulik@meil.pw.edu.pl> | 2012-06-06 23:03:25 (GMT) |
commit | 334b6dc66881872107611feddddeb779ea7d7e96 (patch) | |
tree | ec2f4f6468a3babaa52d7ed995516ff9c5452e47 /src | |
parent | a486464211ccae2b17049e86a7b05c531c6897a6 (diff) | |
download | SCons-334b6dc66881872107611feddddeb779ea7d7e96.zip SCons-334b6dc66881872107611feddddeb779ea7d7e96.tar.gz SCons-334b6dc66881872107611feddddeb779ea7d7e96.tar.bz2 |
Fixed FindSourceFiles to find leaf nodes.
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 3 | ||||
-rw-r--r-- | src/engine/SCons/Environment.py | 15 | ||||
-rw-r--r-- | src/engine/SCons/Tool/gettext.xml | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/xgettext.py | 18 |
4 files changed, 29 insertions, 11 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f759622..d1aa963 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,6 +5,9 @@ Change Log RELEASE 2.X.X - + From Paweł Tomulik: + - Added gettext toolset + - Fixed FindSourceFiles to find final sources (leaf nodes). From Mortoray: - Make -s (silent mode) be silent about entering subdirs (#2976). diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 529e3a3..d7b4022 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -2238,7 +2238,20 @@ class Base(SubstitutionEnvironment): # srcnode = file.srcnode() # while srcnode != file.srcnode(): # srcnode = file.srcnode() - + # ------------------------------------------------------------------ + # Sure!, the above code is like: + # + # a = b + # while a != b: + # a = b + # return c + # + # Let's do the job as below: + def final_source(node): + while (node != node.srcnode()): + node = node.srcnode() + return node + sources = map( final_source, sources ); # remove duplicates return list(set(sources)) diff --git a/src/engine/SCons/Tool/gettext.xml b/src/engine/SCons/Tool/gettext.xml index 7537882..54ed1d6 100644 --- a/src/engine/SCons/Tool/gettext.xml +++ b/src/engine/SCons/Tool/gettext.xml @@ -33,8 +33,8 @@ so you're encouraged to see their individual documentation. Each of the above tools provides its own builder(s) which may be used to perform particular activities related to software internationalization. You -may be however interested in <emphasis>top-level</emphasis> builders -&b-Translate; and &b-InstallMOFiles; described few paragraphs later. +may be however interested in <emphasis>top-level</emphasis> builder +&b-Translate; described few paragraphs later. To use &t-gettext; tools add <literal>'gettext'</literal> tool to your environment: diff --git a/src/engine/SCons/Tool/xgettext.py b/src/engine/SCons/Tool/xgettext.py index 860e51b..f2f542b 100644 --- a/src/engine/SCons/Tool/xgettext.py +++ b/src/engine/SCons/Tool/xgettext.py @@ -182,19 +182,20 @@ def _scan_xgettext_from_files(target, source, env, files = None, path = None): if not SCons.Util.is_List(path): path = [ path ] + path = SCons.Util.flatten(path) + dirs = () for p in path: if not isinstance(p, SCons.Node.FS.Base): if SCons.Util.is_String(p): p = env.subst(p, source = source, target = target) p = env.arg2nodes(p, env.fs.Dir) - if SCons.Util.is_List(p): - dirs = dirs + tuple(p) - else: - dirs += (p,) + dirs += tuple(p) + # cwd is the default search path (when no path is defined by user) if not dirs: dirs = (env.fs.getcwd(),) + # Parse 'POTFILE.in' files. re_comment = re.compile(r'^#[^\n\r]*$\r?\n?', re.M) re_emptyln = re.compile(r'^[ \t\r]*$\r?\n?', re.M) re_trailws = re.compile(r'[ \t\r]+$') @@ -228,16 +229,17 @@ def _pot_update_emitter(target, source, env): if not SCons.Util.is_List(xfrom): xfrom = [ xfrom ] + xfrom = SCons.Util.flatten(xfrom) + + # Prepare list of 'POTFILE.in' files. files = [] for xf in xfrom: if not isinstance(xf, SCons.Node.FS.Base): if SCons.Util.is_String(xf): + # Interpolate variables in strings xf = env.subst(xf, source = source, target = target) xf = env.arg2nodes(xf) - if SCons.Util.is_List(xf): - files.extend(xf) - else: - files.append(xf) + files.extend(xf) if files: env.Depends(target, files) _scan_xgettext_from_files(target, source, env, files) |