diff options
author | Dan Williams <dcbw@redhat.com> | 2012-12-17 11:37:31 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-12-17 11:37:31 -0600 |
commit | 01becf82d505b7e7be269a23c855e0b0f6ec9b5c (patch) | |
tree | fe2335008f5116d68330ef0b86b57acf540e0698 | |
parent | aeddf3ef8a55de892e06a0e2c4b61e73eaced3e3 (diff) | |
download | external_libqmi-01becf82d505b7e7be269a23c855e0b0f6ec9b5c.zip external_libqmi-01becf82d505b7e7be269a23c855e0b0f6ec9b5c.tar.gz external_libqmi-01becf82d505b7e7be269a23c855e0b0f6ec9b5c.tar.bz2 |
qmi-codegen: fix some python3 compatibility issues
Simple methods are no longer in the string module.
-rw-r--r-- | build-aux/qmi-codegen/Client.py | 12 | ||||
-rw-r--r-- | build-aux/qmi-codegen/Field.py | 4 | ||||
-rw-r--r-- | build-aux/qmi-codegen/Message.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableInteger.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/utils.py | 8 |
5 files changed, 14 insertions, 14 deletions
diff --git a/build-aux/qmi-codegen/Client.py b/build-aux/qmi-codegen/Client.py index 5fa4178..12d4cd6 100644 --- a/build-aux/qmi-codegen/Client.py +++ b/build-aux/qmi-codegen/Client.py @@ -61,10 +61,10 @@ class Client: break translations = { 'underscore' : utils.build_underscore_name(self.name), - 'no_prefix_underscore_upper' : string.upper(utils.build_underscore_name(self.name[4:])), + 'no_prefix_underscore_upper' : utils.build_underscore_name(self.name[4:]).upper(), 'camelcase' : utils.build_camelcase_name(self.name), 'hyphened' : utils.build_dashed_name(self.name), - 'service' : string.upper(self.service) } + 'service' : self.service.upper() } # Emit class header template = ( @@ -207,7 +207,7 @@ class Client: # At least one field in the indication translations['output_camelcase'] = utils.build_camelcase_name(message.output.fullname) translations['bundle_type'] = 'QMI_TYPE_' + utils.remove_prefix(utils.build_underscore_uppercase_name(message.output.fullname), 'QMI_') - translations['service'] = string.upper(self.service) + translations['service'] = self.service.upper() translations['message_name_dashed'] = string.replace(message.name, ' ', '-') inner_template += ( '\n' @@ -263,8 +263,8 @@ class Client: def __emit_methods(self, hfile, cfile, message_list): translations = { 'underscore' : utils.build_underscore_name(self.name), 'camelcase' : utils.build_camelcase_name (self.name), - 'service_lowercase' : string.lower(self.service), - 'service_uppercase' : string.upper(self.service), + 'service_lowercase' : self.service.lower(), + 'service_uppercase' : self.service.upper(), 'service_camelcase' : string.capwords(self.service) } for message in message_list.list: @@ -518,7 +518,7 @@ class Client: """ def emit_sections(self, sfile): translations = { 'underscore' : utils.build_underscore_name(self.name), - 'no_prefix_underscore_upper' : string.upper(utils.build_underscore_name(self.name[4:])), + 'no_prefix_underscore_upper' : utils.build_underscore_name(self.name[4:]).upper(), 'camelcase' : utils.build_camelcase_name (self.name), 'hyphened' : utils.build_dashed_name (self.name) } diff --git a/build-aux/qmi-codegen/Field.py b/build-aux/qmi-codegen/Field.py index 5bf42bc..a3f3a61 100644 --- a/build-aux/qmi-codegen/Field.py +++ b/build-aux/qmi-codegen/Field.py @@ -57,10 +57,10 @@ class Field: self.variable = VariableFactory.create_variable(dictionary, self.fullname, self.container_type) # Create the variable name within the Container - self.variable_name = 'arg_' + string.lower(utils.build_underscore_name(self.name)) + self.variable_name = 'arg_' + utils.build_underscore_name(self.name).lower() # Create the ID enumeration name - self.id_enum_name = string.upper(utils.build_underscore_name(self.prefix + ' TLV ' + self.name)) + self.id_enum_name = utils.build_underscore_name(self.prefix + ' TLV ' + self.name).upper() # Output Fields may have prerequisites self.prerequisites = [] diff --git a/build-aux/qmi-codegen/Message.py b/build-aux/qmi-codegen/Message.py index 04d775e..70179e5 100644 --- a/build-aux/qmi-codegen/Message.py +++ b/build-aux/qmi-codegen/Message.py @@ -53,7 +53,7 @@ class Message: self.fullname = self.prefix + ' ' + self.service + ' ' + self.name # Create the ID enumeration name - self.id_enum_name = string.upper(utils.build_underscore_name(self.fullname)) + self.id_enum_name = utils.build_underscore_name(self.fullname).upper() # Build output container. # Every defined message will have its own output container, which diff --git a/build-aux/qmi-codegen/VariableInteger.py b/build-aux/qmi-codegen/VariableInteger.py index 201c34d..4fe58b7 100644 --- a/build-aux/qmi-codegen/VariableInteger.py +++ b/build-aux/qmi-codegen/VariableInteger.py @@ -247,7 +247,7 @@ class VariableInteger(Variable): '${lp} g_string_append_printf (${printable}, "%s", tmp ? "yes" : "no");\n') elif self.public_format != self.private_format: translations['public_type_underscore'] = utils.build_underscore_name_from_camelcase(self.public_format) - translations['public_type_underscore_upper'] = string.upper(utils.build_underscore_name_from_camelcase(self.public_format)) + translations['public_type_underscore_upper'] = utils.build_underscore_name_from_camelcase(self.public_format).upper() template += ( '#if defined __${public_type_underscore_upper}_IS_ENUM__\n' '${lp} g_string_append_printf (${printable}, "%s", ${public_type_underscore}_get_string ((${public_format})tmp));\n' diff --git a/build-aux/qmi-codegen/utils.py b/build-aux/qmi-codegen/utils.py index 113a78b..5095155 100644 --- a/build-aux/qmi-codegen/utils.py +++ b/build-aux/qmi-codegen/utils.py @@ -54,7 +54,7 @@ def add_copyright(f): Build a header guard string based on the given filename """ def build_header_guard(output_name): - return "__LIBQMI_GLIB_" + string.upper(string.replace (output_name, '-', '_')) + "__" + return "__LIBQMI_GLIB_" + string.replace(output_name, '-', '_').upper() + "__" """ @@ -145,7 +145,7 @@ Build an underscore name from the given full name e.g.: "This is a message" --> "this_is_a_message" """ def build_underscore_name(name): - return string.lower(string.replace (name, ' ', '_')) + return string.replace(name, ' ', '_').lower() """ @@ -153,7 +153,7 @@ Build an underscore uppercase name from the given full name e.g.: "This is a message" --> "THIS_IS_A_MESSAGE" """ def build_underscore_uppercase_name(name): - return string.upper(string.replace (name, ' ', '_')) + return string.replace(name, ' ', '_').upper() """ @@ -178,7 +178,7 @@ Build a dashed lowercase name from the given full name e.g.: "This is a message" --> "this-is-a-message" """ def build_dashed_name(name): - return string.replace(string.lower(name), ' ', '-') + return string.replace(name.lower(), ' ', '-') """ |