1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

python: Stop generating libxml2class.txt

This commit is contained in:
Dan Yeaw
2025-04-11 16:57:23 -04:00
committed by Nick Wellnhofer
parent e26478545f
commit 38cc2b53ed
4 changed files with 1 additions and 17 deletions

1
python/.gitignore vendored
View File

@ -3,6 +3,5 @@
/libxml2-py.c /libxml2-py.c
/libxml2-py.h /libxml2-py.h
/libxml2.py /libxml2.py
/libxml2class.txt
/setup.py /setup.py
/tests/tmp.xml /tests/tmp.xml

View File

@ -32,7 +32,7 @@ python_PYTHON = drv_libxml2.py
nodist_python_PYTHON = libxml2.py nodist_python_PYTHON = libxml2.py
API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
GENERATED = libxml2.py libxml2class.txt $(BUILT_SOURCES) GENERATED = libxml2.py $(BUILT_SOURCES)
CLEANFILES = $(GENERATED) CLEANFILES = $(GENERATED)
all-local: libxml2.py all-local: libxml2.py

View File

@ -1101,13 +1101,9 @@ def buildWrappers():
sys.exit(1) sys.exit(1)
classes = open(os.path.join(dstPref, "libxml2.py"), "w") classes = open(os.path.join(dstPref, "libxml2.py"), "w")
txt = open(os.path.join(dstPref, "libxml2class.txt"), "w")
classes.write(libxml_content) classes.write(libxml_content)
txt.write(" Generated Classes for libxml2-python\n\n")
txt.write("#\n# Global functions of the module\n#\n\n")
if "None" in function_classes: if "None" in function_classes:
flist = function_classes["None"] flist = function_classes["None"]
flist = sorted(flist, key=cmp_to_key(functionCompare)) flist = sorted(flist, key=cmp_to_key(functionCompare))
@ -1116,10 +1112,8 @@ def buildWrappers():
(index, func, name, ret, args, file) = info (index, func, name, ret, args, file) = info
if file != oldfile: if file != oldfile:
classes.write("#\n# Functions from module %s\n#\n\n" % file) classes.write("#\n# Functions from module %s\n#\n\n" % file)
txt.write("\n# functions from module %s\n" % file)
oldfile = file oldfile = file
classes.write("def %s(" % func) classes.write("def %s(" % func)
txt.write("%s()\n" % func)
n = 0 n = 0
for arg in args: for arg in args:
if n != 0: if n != 0:
@ -1195,14 +1189,11 @@ def buildWrappers():
classes.write(" return ret\n") classes.write(" return ret\n")
classes.write("\n") classes.write("\n")
txt.write("\n\n#\n# Set of classes of the module\n#\n\n")
for classname in classes_list: for classname in classes_list:
if classname == "None": if classname == "None":
pass pass
else: else:
if classname in classes_ancestor: if classname in classes_ancestor:
txt.write("\n\nClass %s(%s)\n" % (classname,
classes_ancestor[classname]))
classes.write("class %s(%s):\n" % (classname, classes.write("class %s(%s):\n" % (classname,
classes_ancestor[classname])) classes_ancestor[classname]))
classes.write(" def __init__(self, _obj=None):\n") classes.write(" def __init__(self, _obj=None):\n")
@ -1226,7 +1217,6 @@ def buildWrappers():
classes.write(" return \"%s\" %% (self.name, int(pos_id (self)))\n\n" % ( classes.write(" return \"%s\" %% (self.name, int(pos_id (self)))\n\n" % (
format)) format))
else: else:
txt.write("Class %s()\n" % (classname))
classes.write("class %s:\n" % (classname)) classes.write("class %s:\n" % (classname))
classes.write(" def __init__(self, _obj=None):\n") classes.write(" def __init__(self, _obj=None):\n")
if classname in reference_keepers: if classname in reference_keepers:
@ -1257,16 +1247,13 @@ def buildWrappers():
if file != oldfile: if file != oldfile:
if file == "python_accessor": if file == "python_accessor":
classes.write(" # accessors for %s\n" % (classname)) classes.write(" # accessors for %s\n" % (classname))
txt.write(" # accessors\n")
else: else:
classes.write(" #\n") classes.write(" #\n")
classes.write(" # %s functions from module %s\n" % ( classes.write(" # %s functions from module %s\n" % (
classname, file)) classname, file))
txt.write("\n # functions from module %s\n" % file)
classes.write(" #\n\n") classes.write(" #\n\n")
oldfile = file oldfile = file
classes.write(" def %s(self" % func) classes.write(" def %s(self" % func)
txt.write(" %s()\n" % func)
n = 0 n = 0
for arg in args: for arg in args:
if n != index: if n != index:
@ -1391,7 +1378,6 @@ def buildWrappers():
classes.write("%s = %s\n" % (name,value)) classes.write("%s = %s\n" % (name,value))
classes.write("\n") classes.write("\n")
txt.close()
classes.close() classes.close()
buildStubs() buildStubs()

View File

@ -17,7 +17,6 @@ if py.found() == true
'libxml2-export.c', 'libxml2-export.c',
'libxml2-py.c', 'libxml2-py.c',
'libxml2.py', 'libxml2.py',
'libxml2class.txt',
], ],
command: [py, '@INPUT@', meson.current_build_dir()], command: [py, '@INPUT@', meson.current_build_dir()],
) )