summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-12-08 04:43:08 (GMT)
committerSteven Knight <knight@baldmt.com>2003-12-08 04:43:08 (GMT)
commitf1ccb4d7a026f658c80a058827bda351394a01bc (patch)
treee00375c2b4c22646c121e5d20555b67ae0a804c6 /src
parent51df374228f9684ec84bebac6e3cc171b2b5f4e6 (diff)
downloadSCons-f1ccb4d7a026f658c80a058827bda351394a01bc.zip
SCons-f1ccb4d7a026f658c80a058827bda351394a01bc.tar.gz
SCons-f1ccb4d7a026f658c80a058827bda351394a01bc.tar.bz2
Relax the duplicate-environment restriction for targets so that it's okay if the two environments would build the target with the same command or function call. (Scott Fritchie)
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt6
-rw-r--r--src/engine/SCons/Builder.py12
-rw-r--r--src/engine/SCons/Script/__init__.py1
-rw-r--r--src/engine/SCons/Warnings.py3
4 files changed, 21 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index a4e4c60..391d11b 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -61,6 +61,12 @@ RELEASE 0.95 - XXX
- Make the message about ignoring a missing SConscript file into a
suppressable Warning, not a hard-coded sys.stderr.write().
+ - If a builder can be called multiple times for a target (because
+ the sources and overrides are identical, or it's a builder with the
+ "multi" flag set), allow the builder to be called through multiple
+ environments so long as the builders have the same signature for
+ the environments in questions (that is, they're the same action).
+
From Steven Knight:
- Fix EnsureSConsVersion() so it checks against the SCons version,
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index 17d661c..8372292 100644
--- a/src/engine/SCons/Builder.py
+++ b/src/engine/SCons/Builder.py
@@ -164,9 +164,19 @@ def _init_nodes(builder, env, overrides, tlist, slist):
raise UserError, "Multiple ways to build the same target were specified for: %s" % str(t)
if t.has_builder():
if t.env != env:
- raise UserError, "Two different environments were specified for the same target: %s"%str(t)
+ t_contents = t.builder.action.get_contents(tlist, slist, t.env)
+ contents = t.builder.action.get_contents(tlist, slist, env)
+
+ if t_contents == contents:
+ SCons.Warnings.warn(SCons.Warnings.DuplicateEnvironmentWarning,
+ "Two different environments were specified for target %s,\n\tbut they appear to have the same action: %s"%(str(t), t.builder.action.strfunction(tlist, slist, t.env)))
+
+ else:
+ raise UserError, "Two environments with different actions were specified for the same target: %s"%str(t)
+
elif t.overrides != overrides:
raise UserError, "Two different sets of overrides were specified for the same target: %s"%str(t)
+
elif builder.scanner and t.target_scanner and builder.scanner != t.target_scanner:
raise UserError, "Two different scanners were specified for the same target: %s"%str(t)
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index 0e56214..ac05f3c 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -709,6 +709,7 @@ def _main(args, parser):
SCons.Warnings._warningOut = _scons_internal_warning
SCons.Warnings.enableWarningClass(SCons.Warnings.CorruptSConsignWarning)
SCons.Warnings.enableWarningClass(SCons.Warnings.DeprecatedWarning)
+ SCons.Warnings.enableWarningClass(SCons.Warnings.DuplicateEnvironmentWarning)
SCons.Warnings.enableWarningClass(SCons.Warnings.MissingSConscriptWarning)
SCons.Warnings.enableWarningClass(SCons.Warnings.NoParallelSupportWarning)
diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py
index 6426830..2e2e525 100644
--- a/src/engine/SCons/Warnings.py
+++ b/src/engine/SCons/Warnings.py
@@ -48,6 +48,9 @@ class DependencyWarning(Warning):
class DeprecatedWarning(Warning):
pass
+class DuplicateEnvironmentWarning(Warning):
+ pass
+
class MissingSConscriptWarning(Warning):
pass