scripts: update-girs: Normalize shared-library extensions for macOS
So the script can be used on mac Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8476>
This commit is contained in:
parent
7a70860ac0
commit
2df47c1300
@ -25,6 +25,15 @@ def make_rel(elem, gir_relpath):
|
|||||||
elem.attrib["filename"] = str('..' / girdir / filepath)
|
elem.attrib["filename"] = str('..' / girdir / filepath)
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_shared_library(namespace_elem):
|
||||||
|
"""Replace .dylib with .so.0 in shared-library attribute"""
|
||||||
|
if "shared-library" in namespace_elem.attrib:
|
||||||
|
shared_lib = namespace_elem.attrib["shared-library"]
|
||||||
|
if shared_lib.endswith(".0.dylib"):
|
||||||
|
normalized_lib = shared_lib.replace(".0.dylib", ".so.0")
|
||||||
|
namespace_elem.attrib["shared-library"] = normalized_lib
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
opts = PARSER.parse_args()
|
opts = PARSER.parse_args()
|
||||||
girdir = P(__file__).parent.parent / 'girs'
|
girdir = P(__file__).parent.parent / 'girs'
|
||||||
@ -39,4 +48,7 @@ if __name__ == "__main__":
|
|||||||
for n in et.iter("{http://www.gtk.org/introspection/core/1.0}doc"):
|
for n in et.iter("{http://www.gtk.org/introspection/core/1.0}doc"):
|
||||||
del n.attrib["line"]
|
del n.attrib["line"]
|
||||||
make_rel(n, gir_relpath)
|
make_rel(n, gir_relpath)
|
||||||
|
# Normalize shared library names
|
||||||
|
for namespace in et.iter("{http://www.gtk.org/introspection/core/1.0}namespace"):
|
||||||
|
normalize_shared_library(namespace)
|
||||||
et.write(str(girdir / os.path.basename(girfile)), pretty_print=True)
|
et.write(str(girdir / os.path.basename(girfile)), pretty_print=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user