PY3: bytes.maketrans, string.maketrans is a PY2 only function
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> (cherry picked from Samba commit b342e6f038b5277cf30115f11cf0f30d238c12ea)
This commit is contained in:

committed by
Nico Williams

parent
07e3cbb7fb
commit
96b410ed46
@@ -37,6 +37,7 @@
|
||||
import datetime
|
||||
import string
|
||||
import os
|
||||
import sys
|
||||
|
||||
class GeneratedFile :
|
||||
"Represents a generated file"
|
||||
@@ -56,7 +57,11 @@ class GeneratedFile :
|
||||
|
||||
class Header(GeneratedFile) :
|
||||
"Represents a generated header file"
|
||||
guardTrans = string.maketrans('-.', '__')
|
||||
if sys.hexversion>0x300000f:
|
||||
guardTrans = bytes.maketrans(b'-.', b'__')
|
||||
else:
|
||||
import string
|
||||
guardTrans = string.maketrans('-.', '__')
|
||||
def makeGuard(self) :
|
||||
"""Return a name to be used as ifdef guard"""
|
||||
return string.upper(string.translate(self.name, self.guardTrans))
|
||||
|
Reference in New Issue
Block a user