From: Andrew Gaffney Date: Sun, 11 Jan 2009 21:47:29 +0000 (-0600) Subject: Move list_to_string() from catalyst.support to catalyst.util X-Git-Tag: CATALYST-2.0.10~3^2~204 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9ae2c63afcc0b8e78cf4c7dbd9a63033f12b8a44;p=catalyst.git Move list_to_string() from catalyst.support to catalyst.util --- diff --git a/ChangeLog b/ChangeLog index 4afc247d..91cd8e08 100644 --- 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 + 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 modules/catalyst/output.py, modules/catalyst/support.py, modules/catalyst/target/generic_stage.py, modules/catalyst/target/grp.py, diff --git a/modules/catalyst/support.py b/modules/catalyst/support.py index 44911a10..47e25744 100644 --- a/modules/catalyst/support.py +++ b/modules/catalyst/support.py @@ -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: diff --git a/modules/catalyst/target/stage1.py b/modules/catalyst/target/stage1.py index 2557bdd2..369d02f0 100644 --- a/modules/catalyst/target/stage1.py +++ b/modules/catalyst/target/stage1.py @@ -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) diff --git a/modules/catalyst/target/stage2.py b/modules/catalyst/target/stage2.py index a9f24b07..0c38337b 100644 --- a/modules/catalyst/target/stage2.py +++ b/modules/catalyst/target/stage2.py @@ -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) diff --git a/modules/catalyst/util.py b/modules/catalyst/util.py index c27f5f06..815c23e8 100644 --- a/modules/catalyst/util.py +++ b/modules/catalyst/util.py @@ -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 +