From d6bb5d79e3726d2aad82b52fe637030177b4950f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 9 Dec 2012 17:21:40 +0100
Subject: Replace MergeFlags calls by UseFlags calls.

Change-Id: If7193006987fd86d102e5e17aac426ef1a6ccd83

diff --git a/BuildTools/SCons/Tools/Flags.py b/BuildTools/SCons/Tools/Flags.py
index 13fbb32..c130faf 100644
--- a/BuildTools/SCons/Tools/Flags.py
+++ b/BuildTools/SCons/Tools/Flags.py
@@ -3,7 +3,10 @@ import SCons.Util
 def generate(env) :
   def useFlags(env, flags) :
     for flag in flags :
-      env[flag] = env.get(flag, []) + flags[flag]
+      if flag in env :
+        env[flag] = env[flag] + flags[flag]
+      else :
+        env[flag] = flags[flag]
   env.AddMethod(useFlags, "UseFlags")
 
 def exists(env) :
diff --git a/Swiften/Config/SConscript b/Swiften/Config/SConscript
index 357a5e6..f964993 100644
--- a/Swiften/Config/SConscript
+++ b/Swiften/Config/SConscript
@@ -17,8 +17,8 @@ def cStringVariable(env, cVar, sconsVar) :
 config_flags = ""
 
 swiften_env = env.Clone()
-swiften_env.MergeFlags(swiften_env["SWIFTEN_FLAGS"])
-swiften_env.MergeFlags(swiften_env["SWIFTEN_DEP_FLAGS"])
+swiften_env.UseFlags(swiften_env["SWIFTEN_FLAGS"])
+swiften_env.UseFlags(swiften_env["SWIFTEN_DEP_FLAGS"])
 
 cppflags = replaceSwiftenPath(" ".join([swiften_env.subst("$_CPPDEFFLAGS"), swiften_env.subst("$_CPPINCFLAGS")]))
 config_flags += cStringVariable(swiften_env, "CPPFLAGS", cppflags)
@@ -29,8 +29,8 @@ config_flags += cStringVariable(swiften_env, "LIBFLAGS", libflags)
 config_env = env.Clone()
 # Create a local copy of Paths.cpp to avoid a Swiften dependency
 config_env.Install(".", "#/Swiften/Base/Paths.cpp")
-config_env.MergeFlags(config_env["BOOST_FLAGS"])
-config_env.MergeFlags(config_env["PLATFORM_FLAGS"])
+config_env.UseFlags(config_env["BOOST_FLAGS"])
+config_env.UseFlags(config_env["PLATFORM_FLAGS"])
 config_env.WriteVal("swiften-config.h", config_env.Value(config_flags))
 swiften_config = config_env.Program("swiften-config", [
 		"Paths.cpp",
diff --git a/Swiften/Examples/ConnectivityTest/SConscript b/Swiften/Examples/ConnectivityTest/SConscript
index 7bc3892..55a0821 100644
--- a/Swiften/Examples/ConnectivityTest/SConscript
+++ b/Swiften/Examples/ConnectivityTest/SConscript
@@ -1,7 +1,7 @@
 Import("env")
 
 myenv = env.Clone()
-myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
-myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"])
 
 tester = myenv.Program("ConnectivityTest", ["ConnectivityTest.cpp"])
diff --git a/Swiften/Examples/LinkLocalTool/SConscript b/Swiften/Examples/LinkLocalTool/SConscript
index 788f5c1..18eb91f 100644
--- a/Swiften/Examples/LinkLocalTool/SConscript
+++ b/Swiften/Examples/LinkLocalTool/SConscript
@@ -1,8 +1,8 @@
 Import("env")
 
 myenv = env.Clone()
-myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
-myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"])
 
 linkLocalTool = myenv.Program("LinkLocalTool", [
 		"main.cpp"
diff --git a/Swiften/Examples/ParserTester/SConscript b/Swiften/Examples/ParserTester/SConscript
index 09cffc9..5c93552 100644
--- a/Swiften/Examples/ParserTester/SConscript
+++ b/Swiften/Examples/ParserTester/SConscript
@@ -1,7 +1,7 @@
 Import("env")
 
 myenv = env.Clone()
-myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
-myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"])
 
 myenv.Program("ParserTester", ["ParserTester.cpp"])
diff --git a/Swiften/Examples/SendFile/SConscript b/Swiften/Examples/SendFile/SConscript
index d335513..e0f1256 100644
--- a/Swiften/Examples/SendFile/SConscript
+++ b/Swiften/Examples/SendFile/SConscript
@@ -1,8 +1,8 @@
 Import("env")
 
 myenv = env.Clone()
-myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
-myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"])
 
 myenv.Program("SendFile", ["SendFile.cpp"])
 myenv.Program("ReceiveFile", ["ReceiveFile.cpp"])
diff --git a/Swiften/Examples/SendMessage/SConscript b/Swiften/Examples/SendMessage/SConscript
index 8907d25..0466187 100644
--- a/Swiften/Examples/SendMessage/SConscript
+++ b/Swiften/Examples/SendMessage/SConscript
@@ -1,7 +1,7 @@
 Import("env")
 
 myenv = env.Clone()
-myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
-myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_FLAGS"])
+myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"])
 
 tester = myenv.Program("SendMessage", ["SendMessage.cpp"])
diff --git a/Swiftob/SConscript b/Swiftob/SConscript
index bb056bb..b53057c 100644
--- a/Swiftob/SConscript
+++ b/Swiftob/SConscript
@@ -3,9 +3,9 @@ Import("env")
 
 if env["SCONS_STAGE"] == "build":
 	myenv = env.Clone()
-	myenv.MergeFlags(myenv.get("LUA_FLAGS", {}))
-	myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
-	myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"])
+	myenv.UseFlags(myenv.get("LUA_FLAGS", {}))
+	myenv.UseFlags(myenv["SWIFTEN_FLAGS"])
+	myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"])
 	sources = [
 		"linit.cpp",
 		"Swiftob.cpp",
-- 
cgit v0.10.2-6-g49f6