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 A292A13888F for ; Tue, 6 Oct 2015 03:48:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4759C21C01D; Tue, 6 Oct 2015 03:48:25 +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 D2D0021C01D for ; Tue, 6 Oct 2015 03:48:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id F18ED340836 for ; Tue, 6 Oct 2015 03:48:22 +0000 (UTC) From: Mike Frysinger To: gentoo-catalyst@lists.gentoo.org Subject: [gentoo-catalyst] [PATCH] lint: drop use of deprecated string module Date: Mon, 5 Oct 2015 23:48:21 -0400 Message-Id: <1444103301-14607-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: 590a9317-980c-4552-9bb1-c50fb6e31469 X-Archives-Hash: f79013c20e95818580e04215ef390520 Replace string.join() with ' '.join() and string.replace(var, ...) with var.replace(...) as the string module is deprecated. No real functional changes here otherwise. --- catalyst/base/stagebase.py | 33 ++++++++++++++++----------------- catalyst/support.py | 8 ++++---- catalyst/targets/livecd_stage1.py | 3 +-- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 8a7456e..432ad5c 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -1,6 +1,5 @@ import os -import string import imp import types import shutil @@ -312,7 +311,7 @@ class StageBase(TargetBase, ClearBase, GenBase): if "install_mask" in self.settings: if type(self.settings["install_mask"])!=types.StringType: self.settings["install_mask"]=\ - string.join(self.settings["install_mask"]) + ' '.join(self.settings["install_mask"]) def set_spec_prefix(self): self.settings["spec_prefix"]=self.settings["target"] @@ -596,7 +595,7 @@ class StageBase(TargetBase, ClearBase, GenBase): self.settings["portage_overlay"]=\ self.settings["portage_overlay"].split() print "portage_overlay directories are set to: \""+\ - string.join(self.settings["portage_overlay"])+"\"" + ' '.join(self.settings["portage_overlay"])+"\"" def set_overlay(self): if self.settings["spec_prefix"]+"/overlay" in self.settings: @@ -1134,7 +1133,7 @@ class StageBase(TargetBase, ClearBase, GenBase): if myusevars: myf.write("# These are the USE and USE_EXPAND flags that were used for\n# building in addition to what is provided by the profile.\n") myusevars = sorted(set(myusevars)) - myf.write('USE="'+string.join(myusevars)+'"\n') + myf.write('USE="' + ' '.join(myusevars) + '"\n') if '-*' in myusevars: print "\nWarning!!! " print "\tThe use of -* in "+self.settings["spec_prefix"]+\ @@ -1148,7 +1147,7 @@ class StageBase(TargetBase, ClearBase, GenBase): if myuseexpandvars: for hostuseexpand in myuseexpandvars: - myf.write(hostuseexpand+'="'+string.join(myuseexpandvars[hostuseexpand])+'"\n') + myf.write(hostuseexpand + '="' + ' '.join(myuseexpandvars[hostuseexpand]) + '"\n') myf.write('PORTDIR="%s"\n' % self.settings['portdir']) myf.write('DISTDIR="%s"\n' % self.settings['distdir']) @@ -1354,16 +1353,16 @@ class StageBase(TargetBase, ClearBase, GenBase): self.env['clst_' + opt.upper()] = "true" continue """ Sanitize var names by doing "s|/-.|_|g" """ - varname="clst_"+string.replace(x,"/","_") - varname=string.replace(varname,"-","_") - varname=string.replace(varname,".","_") + varname = "clst_" + x.replace("/", "_") + varname = varname.replace("-", "_") + varname = varname.replace(".", "_") if type(self.settings[x])==types.StringType: """ Prefix to prevent namespace clashes """ #os.environ[varname]=self.settings[x] self.env[varname]=self.settings[x] elif type(self.settings[x])==types.ListType: - #os.environ[varname]=string.join(self.settings[x]) - self.env[varname]=string.join(self.settings[x]) + #os.environ[varname] = ' '.join(self.settings[x]) + self.env[varname] = ' '.join(self.settings[x]) elif type(self.settings[x])==types.BooleanType: if self.settings[x]: self.env[varname] = "true" @@ -1377,15 +1376,15 @@ class StageBase(TargetBase, ClearBase, GenBase): if x in ["compress_definitions", "decompress_definitions"]: continue - self.env[varname] = string.join(self.settings[x].keys()) + self.env[varname] = ' '.join(self.settings[x].keys()) for y in self.settings[x].keys(): - varname2 = "clst_"+string.replace(y,"/","_") - varname2 = string.replace(varname2,"-","_") - varname2 = string.replace(varname2,".","_") + varname2 = "clst_" + y.replace("/", "_") + varname2 = varname2.replace("-", "_") + varname2 = varname2.replace(".", "_") if type(self.settings[x][y]) == types.StringType: self.env[varname2] = self.settings[x][y] elif type(self.settings[x][y]) == types.ListType: - self.env[varname2] = string.join(self.settings[x][y]) + self.env[varname2] = ' '.join(self.settings[x][y]) elif type(self.settings[x][y]) == types.BooleanType: if self.settings[x][y]: self.env[varname] = "true" @@ -1464,7 +1463,7 @@ class StageBase(TargetBase, ClearBase, GenBase): things like "<" to remain intact """ myunmerge[x]="'"+myunmerge[x]+"'" - myunmerge=string.join(myunmerge) + myunmerge = ' '.join(myunmerge) """ Before cleaning, unmerge stuff """ try: @@ -1588,7 +1587,7 @@ class StageBase(TargetBase, ClearBase, GenBase): "/kernelopts"] if type(myopts) != types.StringType: - myopts = string.join(myopts) + myopts = ' '.join(myopts) self.env[kname+"_kernelopts"]=myopts else: diff --git a/catalyst/support.py b/catalyst/support.py index 78942a7..5563a15 100644 --- a/catalyst/support.py +++ b/catalyst/support.py @@ -1,7 +1,7 @@ import glob import sys -import string +import string # pylint: disable=deprecated-module import os import types import re @@ -52,7 +52,7 @@ def read_from_clst(file): return -1 #raise CatalystError("Could not open file "+file) for line in myf.readlines(): - #line = string.replace(line, "\n", "") # drop newline + #line = line.replace("\n", "") # drop newline myline = myline + line myf.close() return myline @@ -67,7 +67,7 @@ def list_bashify(mylist): # surround args with quotes for passing to bash, # allows things like "<" to remain intact mypack[x]="'"+mypack[x]+"'" - mypack=string.join(mypack) + mypack = ' '.join(mypack) return mypack @@ -80,7 +80,7 @@ def list_to_string(mylist): # surround args with quotes for passing to bash, # allows things like "<" to remain intact mypack[x]=mypack[x] - mypack=string.join(mypack) + mypack = ' '.join(mypack) return mypack diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py index d5645e8..af59ed7 100644 --- a/catalyst/targets/livecd_stage1.py +++ b/catalyst/targets/livecd_stage1.py @@ -5,7 +5,6 @@ LiveCD stage1 target import os import types -import string from catalyst.support import (normpath, @@ -70,6 +69,6 @@ class livecd_stage1(StageBase): def set_pkgcache_path(self): if "pkgcache_path" in self.settings: if type(self.settings["pkgcache_path"]) != types.StringType: - self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"])) + self.settings["pkgcache_path"]=normpath(' '.join(self.settings["pkgcache_path"])) else: StageBase.set_pkgcache_path(self) -- 2.5.2