From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 648BC13888F for ; Tue, 6 Oct 2015 21:54:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BEA3EE086C; Tue, 6 Oct 2015 21:54:42 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 40054E086C for ; Tue, 6 Oct 2015 21:54:42 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 310683406F3 for ; Tue, 6 Oct 2015 21:54:38 +0000 (UTC) From: Mike Frysinger 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 Message-Id: <1444168476-17899-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 2.5.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Archives-Salt: d6a7a566-e54a-4a7f-8ccb-31d98b2aa2ab X-Archives-Hash: 0999a144e71e1491af75d5a6933896a8 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