[elbe-devel] [PATCH 08/25] [V2] py3: replace static string functions
Manuel Traut
manut at linutronix.de
Fri Dec 8 19:08:39 CET 2017
strip, join, etc is no longer a static member function of string in python3
Signed-off-by: Manuel Traut <manut at linutronix.de>
---
elbepack/commands/parselicence.py | 6 +++---
elbepack/dosunix.py | 7 ++++---
elbepack/xmldefaults.py | 2 +-
elbepack/xsdtoasciidoc.mako | 4 ++--
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/elbepack/commands/parselicence.py b/elbepack/commands/parselicence.py
index 7316d6e6..baa3b01f 100644
--- a/elbepack/commands/parselicence.py
+++ b/elbepack/commands/parselicence.py
@@ -83,9 +83,9 @@ class license_dep5_to_spdx (dict):
ands.append (mapped_lic + u" WITH " + with_split[1])
else:
ands.append (mapped_lic)
- ors.append (string.join (ands, u' AND '))
+ ors.append (' AND '.join (ands))
- retval = string.join (ors, u' OR ')
+ retval = ' OR '.join (ors)
return retval
@@ -136,7 +136,7 @@ def license_string (pkg):
else:
l_list.append (ll.et.text)
- return string.join (l_list, ' AND ')
+ return ' AND '.join (l_list)
diff --git a/elbepack/dosunix.py b/elbepack/dosunix.py
index a8b41833..bb677131 100755
--- a/elbepack/dosunix.py
+++ b/elbepack/dosunix.py
@@ -1,12 +1,13 @@
#!/usr/bin/env python
-from string import split, join
def dos2unix_str (d):
- return join (split (d, '\r\n'), '\n')
+ return d.replace('\r\n', '\n')
def unix2dos_str (d):
- return join (split (dos2unix_str (d), '\n'), '\r\n')
+ d = d.replace('\n', '\r\n')
+ d = d.replace('\r\r\n', '\r\n')
+ return d
def __rewrite (fn, rw_func):
with open (fn, 'r+') as f:
diff --git a/elbepack/xmldefaults.py b/elbepack/xmldefaults.py
index de085852..f9cd0069 100644
--- a/elbepack/xmldefaults.py
+++ b/elbepack/xmldefaults.py
@@ -178,7 +178,7 @@ def get_random_mac():
binaddr[0] |= 0x02
s = map( lambda x: "%02x" % x, binaddr )
- return string.join( s, ":" )
+ return ':'.join (s)
class ElbeDefaults(object):
diff --git a/elbepack/xsdtoasciidoc.mako b/elbepack/xsdtoasciidoc.mako
index 093debdf..c2073bab 100644
--- a/elbepack/xsdtoasciidoc.mako
+++ b/elbepack/xsdtoasciidoc.mako
@@ -12,9 +12,9 @@ MINI = "{http://www.w3.org/2001/XMLSchema}minInclusive"
def docindent( s, indent=0 ):
lines = s.splitlines()
- lines = map(string.strip, lines)
+ lines = [l.strip() for l in lines]
lines = map(lambda x: indent*" "+x, lines)
- return string.join(lines).strip()
+ return str('').join(lines).strip()
def genlink(typ):
if typ.startswith("rfs:"):
--
2.15.1
More information about the elbe-devel
mailing list