public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] support: punt pointless list_to_string helper
@ 2015-10-06 21:54 Mike Frysinger
  2015-10-08 22:20 ` Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2015-10-06 21:54 UTC (permalink / raw
  To: gentoo-catalyst

This function is a lot of code that doesn't do a whole lot.
It looks like a blind copy & paste & tweak from list_bashify.
If the input is a string, it returns a copy of it (i.e. it's
pretty much a nop).  If it's a list, it runs ' '.join() on it.
That's all.

But let's not focus on the craziness of implementation.  The
few consumers of this function are already passing in strings
in which case their use is pointless.  Once we delete those
callers, we can delete the implementation.
---
 catalyst/support.py        | 13 -------------
 catalyst/targets/stage1.py | 10 +++++-----
 catalyst/targets/stage2.py | 10 +++++-----
 3 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/catalyst/support.py b/catalyst/support.py
index 62be63a..a26e49c 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -41,19 +41,6 @@ def list_bashify(mylist):
 	return mypack
 
 
-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 = ' '.join(mypack)
-	return mypack
-
-
 class CatalystError(Exception):
 	def __init__(self, message, print_traceback=False):
 		if message:
diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index d5cc298..b5dfac7 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -5,7 +5,7 @@ stage1 target
 
 import os
 
-from catalyst.support import normpath, list_to_string
+from catalyst.support import normpath
 from catalyst.fileops import ensure_dirs
 from catalyst.base.stagebase import StageBase
 
@@ -38,19 +38,19 @@ class stage1(StageBase):
 
 	def override_chost(self):
 		if "chost" in self.settings:
-			self.settings["CHOST"]=list_to_string(self.settings["chost"])
+			self.settings["CHOST"] = self.settings["chost"]
 
 	def override_cflags(self):
 		if "cflags" in self.settings:
-			self.settings["CFLAGS"]=list_to_string(self.settings["cflags"])
+			self.settings["CFLAGS"] = self.settings["cflags"]
 
 	def override_cxxflags(self):
 		if "cxxflags" in self.settings:
-			self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"])
+			self.settings["CXXFLAGS"] = self.settings["cxxflags"]
 
 	def override_ldflags(self):
 		if "ldflags" in self.settings:
-			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
+			self.settings["LDFLAGS"] = self.settings["ldflags"]
 
 	def set_portage_overlay(self):
 		StageBase.set_portage_overlay(self)
diff --git a/catalyst/targets/stage2.py b/catalyst/targets/stage2.py
index affa2cb..befe8bc 100644
--- a/catalyst/targets/stage2.py
+++ b/catalyst/targets/stage2.py
@@ -5,7 +5,7 @@ stage2 target, builds upon previous stage1 tarball
 
 import os
 
-from catalyst.support import normpath, list_to_string
+from catalyst.support import normpath
 from catalyst.base.stagebase import StageBase
 
 
@@ -41,19 +41,19 @@ class stage2(StageBase):
 
 	def override_chost(self):
 		if "chost" in self.settings:
-			self.settings["CHOST"]=list_to_string(self.settings["chost"])
+			self.settings["CHOST"] = self.settings["chost"]
 
 	def override_cflags(self):
 		if "cflags" in self.settings:
-			self.settings["CFLAGS"]=list_to_string(self.settings["cflags"])
+			self.settings["CFLAGS"] = self.settings["cflags"]
 
 	def override_cxxflags(self):
 		if "cxxflags" in self.settings:
-			self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"])
+			self.settings["CXXFLAGS"] = self.settings["cxxflags"]
 
 	def override_ldflags(self):
 		if "ldflags" in self.settings:
-			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
+			self.settings["LDFLAGS"] = self.settings["ldflags"]
 
 	def set_portage_overlay(self):
 		StageBase.set_portage_overlay(self)
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-catalyst] [PATCH] support: punt pointless list_to_string helper
  2015-10-06 21:54 [gentoo-catalyst] [PATCH] support: punt pointless list_to_string helper Mike Frysinger
@ 2015-10-08 22:20 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2015-10-08 22:20 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 60 bytes --]

i've pushed this since it passes snapshots/stage[123]
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-08 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 21:54 [gentoo-catalyst] [PATCH] support: punt pointless list_to_string helper Mike Frysinger
2015-10-08 22:20 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox