From 38cc2b53eda8bf36d3032ada5cf1d4d59dfd322d Mon Sep 17 00:00:00 2001 From: Dan Yeaw Date: Fri, 11 Apr 2025 16:57:23 -0400 Subject: [PATCH] python: Stop generating libxml2class.txt --- python/.gitignore | 1 - python/Makefile.am | 2 +- python/generator.py | 14 -------------- python/meson.build | 1 - 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/python/.gitignore b/python/.gitignore index 811e0bd2..712de517 100644 --- a/python/.gitignore +++ b/python/.gitignore @@ -3,6 +3,5 @@ /libxml2-py.c /libxml2-py.h /libxml2.py -/libxml2class.txt /setup.py /tests/tmp.xml diff --git a/python/Makefile.am b/python/Makefile.am index da57a990..30f62523 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -32,7 +32,7 @@ python_PYTHON = drv_libxml2.py nodist_python_PYTHON = libxml2.py 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) all-local: libxml2.py diff --git a/python/generator.py b/python/generator.py index b79e6385..87be4286 100755 --- a/python/generator.py +++ b/python/generator.py @@ -1101,13 +1101,9 @@ def buildWrappers(): sys.exit(1) classes = open(os.path.join(dstPref, "libxml2.py"), "w") - txt = open(os.path.join(dstPref, "libxml2class.txt"), "w") 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: flist = function_classes["None"] flist = sorted(flist, key=cmp_to_key(functionCompare)) @@ -1116,10 +1112,8 @@ def buildWrappers(): (index, func, name, ret, args, file) = info if file != oldfile: classes.write("#\n# Functions from module %s\n#\n\n" % file) - txt.write("\n# functions from module %s\n" % file) oldfile = file classes.write("def %s(" % func) - txt.write("%s()\n" % func) n = 0 for arg in args: if n != 0: @@ -1195,14 +1189,11 @@ def buildWrappers(): classes.write(" return ret\n") classes.write("\n") - txt.write("\n\n#\n# Set of classes of the module\n#\n\n") for classname in classes_list: if classname == "None": pass else: if classname in classes_ancestor: - txt.write("\n\nClass %s(%s)\n" % (classname, - classes_ancestor[classname])) classes.write("class %s(%s):\n" % (classname, classes_ancestor[classname])) 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" % ( format)) else: - txt.write("Class %s()\n" % (classname)) classes.write("class %s:\n" % (classname)) classes.write(" def __init__(self, _obj=None):\n") if classname in reference_keepers: @@ -1257,16 +1247,13 @@ def buildWrappers(): if file != oldfile: if file == "python_accessor": classes.write(" # accessors for %s\n" % (classname)) - txt.write(" # accessors\n") else: classes.write(" #\n") classes.write(" # %s functions from module %s\n" % ( classname, file)) - txt.write("\n # functions from module %s\n" % file) classes.write(" #\n\n") oldfile = file classes.write(" def %s(self" % func) - txt.write(" %s()\n" % func) n = 0 for arg in args: if n != index: @@ -1391,7 +1378,6 @@ def buildWrappers(): classes.write("%s = %s\n" % (name,value)) classes.write("\n") - txt.close() classes.close() buildStubs() diff --git a/python/meson.build b/python/meson.build index f7622654..a261d850 100644 --- a/python/meson.build +++ b/python/meson.build @@ -17,7 +17,6 @@ if py.found() == true 'libxml2-export.c', 'libxml2-py.c', 'libxml2.py', - 'libxml2class.txt', ], command: [py, '@INPUT@', meson.current_build_dir()], )