Skip to content

Commit 49effa0

Browse files
committed
- apply metaclass
1 parent ca9e7b7 commit 49effa0

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/bindings/python/add_version.cmake

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,30 @@ message ("Python: create 3.x version")
4242

4343
file(READ ${CUR_BIN_DIRECTORY}/libsedml.py init_script)
4444
file(WRITE ${CUR_BIN_DIRECTORY}/libsedml2.py ${init_script})
45-
46-
string(REPLACE
47-
"class SBase(_object):"
48-
"class SBase(_object, metaclass=AutoProperty):"
49-
init3_script ${init_script}
45+
set(CLASSES_TO_UPDATE
46+
"SBase"
47+
"SedBase"
48+
"SedBaseList"
49+
"SedNamespaces"
50+
"SedNamespacesList"
5051
)
5152

52-
string(REPLACE
53-
"class SedBase(_object):"
54-
"class SedBase(_object, metaclass=AutoProperty):"
55-
init3_script ${init3_script}
56-
)
53+
foreach(CLASS ${CLASSES_TO_UPDATE})
54+
string(REPLACE
55+
"class ${CLASS}(_object):"
56+
"class ${CLASS}(_object, metaclass=AutoProperty):"
57+
init3_script ${init_script}
58+
)
59+
60+
string(REPLACE
61+
"class ${CLASS}(object):"
62+
"class ${CLASS}(object, metaclass=AutoProperty):"
63+
init3_script ${init3_script}
64+
)
65+
endforeach()
66+
5767

58-
string(REPLACE
59-
"class SBase(object):"
60-
"class SBase(object, metaclass=AutoProperty):"
61-
init3_script ${init3_script}
62-
)
6368

64-
string(REPLACE
65-
"class SedBase(object):"
66-
"class SedBase(object, metaclass=AutoProperty):"
67-
init3_script ${init3_script}
68-
)
6969

7070

7171
file(WRITE ${CUR_BIN_DIRECTORY}/libsedml3.py ${init3_script})

0 commit comments

Comments
 (0)