diff options
author | Shawn J. Goff <shawn.goff@accelecon.com> | 2012-12-17 16:29:15 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-12-17 16:59:35 -0600 |
commit | 31e3155c414d8d4c7e3ec5d9f0d75d37c6ee1c79 (patch) | |
tree | 6d8ee21640e3db95ba5557ae3fd217c336883bcf /build-aux | |
parent | 01becf82d505b7e7be269a23c855e0b0f6ec9b5c (diff) |
qmi-codegen python3: change string.replace() class method use to str.replace() instance method
Python 3 doesn't support the replace class method; it's now an instance method only.
string.replace(object, old, new) changes to object.replace(old, new)
sed:
s/string\.replace(\([^,]*\), /\1.replace(/
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/qmi-codegen/Client.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableArray.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/utils.py | 11 |
3 files changed, 7 insertions, 8 deletions
diff --git a/build-aux/qmi-codegen/Client.py b/build-aux/qmi-codegen/Client.py index 12d4cd6..071c91b 100644 --- a/build-aux/qmi-codegen/Client.py +++ b/build-aux/qmi-codegen/Client.py @@ -208,7 +208,7 @@ class Client: 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'] = self.service.upper() - translations['message_name_dashed'] = string.replace(message.name, ' ', '-') + translations['message_name_dashed'] = message.name.replace(' ', '-') inner_template += ( '\n' ' /**\n' diff --git a/build-aux/qmi-codegen/VariableArray.py b/build-aux/qmi-codegen/VariableArray.py index f2b122c..c5aadf9 100644 --- a/build-aux/qmi-codegen/VariableArray.py +++ b/build-aux/qmi-codegen/VariableArray.py @@ -86,7 +86,7 @@ class VariableArray(Variable): def clear_func_name(self): # element public format might be a base type like 'gchar *' rather # than a structure name like QmiFooBar - elt_name = string.replace(self.array_element.public_format, '*', 'pointer') + elt_name = self.array_element.public_format.replace('*', 'pointer') return utils.build_underscore_name(self.name) + \ '_' + \ utils.build_underscore_name_from_camelcase(utils.build_camelcase_name(elt_name)) diff --git a/build-aux/qmi-codegen/utils.py b/build-aux/qmi-codegen/utils.py index 5095155..e9d4ea1 100644 --- a/build-aux/qmi-codegen/utils.py +++ b/build-aux/qmi-codegen/utils.py @@ -54,8 +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.replace(output_name, '-', '_').upper() + "__" - + return "__LIBQMI_GLIB_" + output_name.replace('-', '_').upper() + "__" """ Write the common header start chunk @@ -145,7 +144,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.replace(name, ' ', '_').lower() + return name.replace(' ', '_').lower() """ @@ -153,7 +152,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.replace(name, ' ', '_').upper() + return name.replace(' ', '_').upper() """ @@ -170,7 +169,7 @@ Build a camelcase name from the given full name e.g.: "This is a message" --> "ThisIsAMessage" """ def build_camelcase_name(name): - return string.replace(string.capwords(name), ' ', '') + return string.capwords(name).replace(' ', '') """ @@ -178,7 +177,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(name.lower(), ' ', '-') + return name.lower().replace(' ', '-') """ |