mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
python: Concat generated files in generator.py
This commit is contained in:
committed by
Nick Wellnhofer
parent
fc4adba90e
commit
ffef921be3
@ -525,11 +525,6 @@ if(LIBXML2_WITH_PYTHON)
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/python/generator.py
|
${CMAKE_CURRENT_SOURCE_DIR}/python/generator.py
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
file(READ python/libxml.py LIBXML_PY)
|
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML_PY}")
|
|
||||||
file(READ ${CMAKE_CURRENT_BINARY_DIR}/libxml2class.py LIBXML2CLASS_PY)
|
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML2CLASS_PY}")
|
|
||||||
configure_file(${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in libxml2.py COPYONLY)
|
|
||||||
add_library(
|
add_library(
|
||||||
LibXml2Mod SHARED
|
LibXml2Mod SHARED
|
||||||
libxml2-py.c
|
libxml2-py.c
|
||||||
|
1
python/.gitignore
vendored
1
python/.gitignore
vendored
@ -3,7 +3,6 @@
|
|||||||
/libxml2-py.c
|
/libxml2-py.c
|
||||||
/libxml2-py.h
|
/libxml2-py.h
|
||||||
/libxml2.py
|
/libxml2.py
|
||||||
/libxml2class.py
|
|
||||||
/libxml2class.txt
|
/libxml2class.txt
|
||||||
/setup.py
|
/setup.py
|
||||||
/tests/tmp.xml
|
/tests/tmp.xml
|
||||||
|
@ -32,8 +32,8 @@ 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 = libxml2class.py libxml2class.txt $(BUILT_SOURCES)
|
GENERATED = libxml2.py libxml2class.txt $(BUILT_SOURCES)
|
||||||
CLEANFILES = libxml2.py $(GENERATED)
|
CLEANFILES = $(GENERATED)
|
||||||
|
|
||||||
all-local: libxml2.py
|
all-local: libxml2.py
|
||||||
|
|
||||||
@ -43,9 +43,6 @@ $(GENERATED): $(srcdir)/generator.py $(API_DESC)
|
|||||||
# libxml.c #includes libxml2-export.c
|
# libxml.c #includes libxml2-export.c
|
||||||
libxml.$(OBJEXT): libxml2-export.c
|
libxml.$(OBJEXT): libxml2-export.c
|
||||||
|
|
||||||
libxml2.py: $(srcdir)/libxml.py libxml2class.py
|
|
||||||
cat $(srcdir)/libxml.py `test -f libxml2class.py || echo $(srcdir)/`libxml2class.py > $@
|
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf __pycache__ *.pyc
|
rm -rf __pycache__ *.pyc
|
||||||
|
|
||||||
|
@ -1091,9 +1091,20 @@ def buildWrappers():
|
|||||||
func = nameFixup(name, "None", file, file)
|
func = nameFixup(name, "None", file, file)
|
||||||
info = (0, func, name, ret, args, file)
|
info = (0, func, name, ret, args, file)
|
||||||
function_classes['None'].append(info)
|
function_classes['None'].append(info)
|
||||||
|
|
||||||
classes = open(os.path.join(dstPref, "libxml2class.py"), "w")
|
libxml_content = ""
|
||||||
|
try:
|
||||||
|
with open(os.path.join(srcPref, "libxml.py"), "r") as libxml_file:
|
||||||
|
libxml_content = libxml_file.read()
|
||||||
|
except IOError as msg:
|
||||||
|
print("Error reading libxml.py:", msg)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
classes = open(os.path.join(dstPref, "libxml2.py"), "w")
|
||||||
txt = open(os.path.join(dstPref, "libxml2class.txt"), "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(" Generated Classes for libxml2-python\n\n")
|
||||||
|
|
||||||
txt.write("#\n# Global functions of the module\n#\n\n")
|
txt.write("#\n# Global functions of the module\n#\n\n")
|
||||||
|
@ -16,7 +16,7 @@ if py.found() == true
|
|||||||
'libxml2-py.h',
|
'libxml2-py.h',
|
||||||
'libxml2-export.c',
|
'libxml2-export.c',
|
||||||
'libxml2-py.c',
|
'libxml2-py.c',
|
||||||
'libxml2class.py',
|
'libxml2.py',
|
||||||
'libxml2class.txt',
|
'libxml2class.txt',
|
||||||
],
|
],
|
||||||
command: [py, '@INPUT@', meson.current_build_dir()],
|
command: [py, '@INPUT@', meson.current_build_dir()],
|
||||||
@ -25,16 +25,6 @@ if py.found() == true
|
|||||||
sources : [pygenerated[0]],
|
sources : [pygenerated[0]],
|
||||||
)
|
)
|
||||||
|
|
||||||
libxml2_py = custom_target(
|
|
||||||
'libxml2.py',
|
|
||||||
input: [files('libxml.py'), pygenerated[3]],
|
|
||||||
output: 'libxml2.py',
|
|
||||||
command: [find_program('cat'), '@INPUT@'],
|
|
||||||
capture: true,
|
|
||||||
install: true,
|
|
||||||
install_dir: py.get_install_dir(),
|
|
||||||
)
|
|
||||||
|
|
||||||
libxml2mod_src = [
|
libxml2mod_src = [
|
||||||
files('libxml.c', 'types.c'),
|
files('libxml.c', 'types.c'),
|
||||||
pygenerated[2],
|
pygenerated[2],
|
||||||
|
@ -116,20 +116,6 @@ if missing("libxml2-py.c") or missing("libxml2.py"):
|
|||||||
print(sys.exc_info()[0], sys.exc_info()[1])
|
print(sys.exc_info()[0], sys.exc_info()[1])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
head = open("libxml.py", "r")
|
|
||||||
generated = open("libxml2class.py", "r")
|
|
||||||
result = open("libxml2.py", "w")
|
|
||||||
for line in head.readlines():
|
|
||||||
if WITHDLLS:
|
|
||||||
result.write(altImport(line))
|
|
||||||
else:
|
|
||||||
result.write(line)
|
|
||||||
for line in generated.readlines():
|
|
||||||
result.write(line)
|
|
||||||
head.close()
|
|
||||||
generated.close()
|
|
||||||
result.close()
|
|
||||||
|
|
||||||
with_xslt=0
|
with_xslt=0
|
||||||
if missing("libxslt-py.c") or missing("libxslt.py"):
|
if missing("libxslt-py.c") or missing("libxslt.py"):
|
||||||
if missing("xsltgenerator.py") or missing("libxslt-api.xml"):
|
if missing("xsltgenerator.py") or missing("libxslt-api.xml"):
|
||||||
|
Reference in New Issue
Block a user