Skip to content

Commit

Permalink
qapi: Adapt to moved location of 'maketrans' function in py3
Browse files Browse the repository at this point in the history
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-6-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
  • Loading branch information
berrange authored and ehabkost committed Feb 5, 2018
1 parent 5f90af8 commit 52c4272
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/qapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,10 @@ def c_enum_const(type_name, const_name, prefix=None):
type_name = prefix
return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper()

c_name_trans = string.maketrans('.-', '__')
if hasattr(str, 'maketrans'):
c_name_trans = str.maketrans('.-', '__')
else:
c_name_trans = string.maketrans('.-', '__')


# Map @name to a valid C identifier.
Expand Down

0 comments on commit 52c4272

Please sign in to comment.