Move list_to_string() from catalyst.support to catalyst.util
authorAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 21:47:29 +0000 (15:47 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 21:47:29 +0000 (15:47 -0600)
ChangeLog
modules/catalyst/support.py
modules/catalyst/target/stage1.py
modules/catalyst/target/stage2.py
modules/catalyst/util.py

index 4afc247d1e01f0088b03a56c8987715e47ca5c8c..91cd8e0897bf857bc3f33aec3b86b762723b90ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
 # Distributed under the GPL v2
 
+  11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+  modules/catalyst/support.py, modules/catalyst/target/stage1.py,
+  modules/catalyst/target/stage2.py, modules/catalyst/util.py:
+  Move list_to_string() from catalyst.support to catalyst.util
+
   11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
   modules/catalyst/output.py, modules/catalyst/support.py,
   modules/catalyst/target/generic_stage.py, modules/catalyst/target/grp.py,
index 44911a10da0d3bbc45708d07b2f21703c2c7fd14..47e257441f0a9a63c6a2648d23c72165d9bf0a75 100644 (file)
@@ -205,18 +205,6 @@ valid_config_file_values.append("SEEDCACHE")
 
 verbosity=1
 
-def list_to_string(mylist):
-       if type(mylist)==types.StringType:
-               mypack=[mylist]
-       else:
-               mypack=mylist[:]
-       for x in range(0,len(mypack)):
-               # surround args with quotes for passing to bash,
-               # allows things like "<" to remain intact
-               mypack[x]=mypack[x]
-       mypack=string.join(mypack)
-       return mypack
-
 class CatalystError(Exception):
        def __init__(self, message):
                if message:
index 2557bdd2add741e249472a515a195fd4f816029a..369d02f0ebb0ef6d073457a182897c8a81e4da92 100644 (file)
@@ -5,6 +5,7 @@ Builder class for a stage1 installation tarball build.
 
 from catalyst.support import *
 from generic_stage import *
+import catalyst.util
 
 class stage1_target(generic_stage_target):
        def __init__(self,spec,addlargs):
@@ -35,19 +36,19 @@ class stage1_target(generic_stage_target):
 
        def override_chost(self):
                if "chost" in self.settings:
-                       self.settings["CHOST"]=list_to_string(self.settings["chost"])
+                       self.settings["CHOST"] = catalyst.util.list_to_string(self.settings["chost"])
 
        def override_cflags(self):
                if "cflags" in self.settings:
-                       self.settings["CFLAGS"]=list_to_string(self.settings["cflags"])
+                       self.settings["CFLAGS"] = catalyst.util.list_to_string(self.settings["cflags"])
 
        def override_cxxflags(self):
                if "cxxflags" in self.settings:
-                       self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"])
+                       self.settings["CXXFLAGS"] = catalyst.util.list_to_string(self.settings["cxxflags"])
 
        def override_ldflags(self):
                if "ldflags" in self.settings:
-                       self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
+                       self.settings["LDFLAGS"] = catalyst.util.list_to_string(self.settings["ldflags"])
 
        def set_portage_overlay(self):
                generic_stage_target.set_portage_overlay(self)
index a9f24b07e58dd803f46db4d7db905b7329ebdc0e..0c38337bce0d281097265ccefdfd21cde3c524d5 100644 (file)
@@ -5,6 +5,7 @@ Builder class for a stage2 installation tarball build.
 
 from catalyst.support import *
 from generic_stage import *
+import catalyst.util
 
 class stage2_target(generic_stage_target):
        def __init__(self,spec,addlargs):
@@ -36,19 +37,19 @@ class stage2_target(generic_stage_target):
 
        def override_chost(self):
                if "chost" in self.settings:
-                       self.settings["CHOST"]=list_to_string(self.settings["chost"])
+                       self.settings["CHOST"] = catalyst.util.list_to_string(self.settings["chost"])
 
        def override_cflags(self):
                if "cflags" in self.settings:
-                       self.settings["CFLAGS"]=list_to_string(self.settings["cflags"])
+                       self.settings["CFLAGS"] = catalyst.util.list_to_string(self.settings["cflags"])
 
        def override_cxxflags(self):
                if "cxxflags" in self.settings:
-                       self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"])
+                       self.settings["CXXFLAGS"] = catalyst.util.list_to_string(self.settings["cxxflags"])
 
        def override_ldflags(self):
                if "ldflags" in self.settings:
-                       self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
+                       self.settings["LDFLAGS"] = catalyst.util.list_to_string(self.settings["ldflags"])
 
        def set_portage_overlay(self):
                        generic_stage_target.set_portage_overlay(self)
index c27f5f0670aa08d3e75a30267668981a0ed2bb89..815c23e8ddf5bbfe66cbdf735b05fdcdd90dbaa4 100644 (file)
@@ -57,3 +57,11 @@ def list_bashify(mylist):
        mypack = "".join(mypack)
        return mypack
 
+def list_to_string(mylist):
+       if isinstance(mylist, str):
+               mypack=[mylist]
+       else:
+               mypack=mylist[:]
+       mypack = " ".join(mypack)
+       return mypack
+