public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Subject: [gentoo-catalyst] [PATCH] support: punt pointless list_to_string helper
Date: Tue,  6 Oct 2015 17:54:36 -0400	[thread overview]
Message-ID: <1444168476-17899-1-git-send-email-vapier@gentoo.org> (raw)

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



             reply	other threads:[~2015-10-06 21:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 21:54 Mike Frysinger [this message]
2015-10-08 22:20 ` [gentoo-catalyst] [PATCH] support: punt pointless list_to_string helper Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444168476-17899-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gentoo-catalyst@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox