mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
enhanced for enabling build in a different directory. Added (optional)
* Makefile.am, gentest.py: enhanced for enabling build in a different directory. Added (optional) param to gentest.py to specify the source directory (bug #155468) * doc/Makefile.am: changed destination of NEWS from (top_srcdir) to (top_builddir) (bug #155468) * python/Makefile.am, python/generator.py: enhanced for enabling build in a different directory(bug #155468). Added (optional) param to generator.py to specify the source directory. Added a new table of functions which have possible "foreign" encodings (e.g. UTF16), and code to use python 't' format instead of 'z' format (mostly solving bug #152286, but still need to populate the table).
This commit is contained in:
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
Thu Dec 23 23:44:08 HKT 2004 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
|
* Makefile.am, gentest.py: enhanced for enabling build in
|
||||||
|
a different directory. Added (optional) param to gentest.py
|
||||||
|
to specify the source directory (bug #155468)
|
||||||
|
* doc/Makefile.am: changed destination of NEWS from (top_srcdir)
|
||||||
|
to (top_builddir) (bug #155468)
|
||||||
|
* python/Makefile.am, python/generator.py: enhanced for enabling
|
||||||
|
build in a different directory(bug #155468). Added (optional)
|
||||||
|
param to generator.py to specify the source directory. Added
|
||||||
|
a new table of functions which have possible "foreign" encodings
|
||||||
|
(e.g. UTF16), and code to use python 't' format instead of
|
||||||
|
'z' format (mostly solving bug #152286, but still need to
|
||||||
|
populate the table).
|
||||||
|
|
||||||
Tue Dec 21 08:10:44 MST 2004 John Fleck <jfleck@inkstain.net>
|
Tue Dec 21 08:10:44 MST 2004 John Fleck <jfleck@inkstain.net>
|
||||||
|
|
||||||
* doc/site.xsl, doc/xml.html, plus rebuilt all the html pages
|
* doc/site.xsl, doc/xml.html, plus rebuilt all the html pages
|
||||||
|
@ -114,7 +114,8 @@ testReader_DEPENDENCIES = $(DEPS)
|
|||||||
testReader_LDADD= $(LDADDS)
|
testReader_LDADD= $(LDADDS)
|
||||||
|
|
||||||
testapi.c: gentest.py doc/libxml2-api.xml
|
testapi.c: gentest.py doc/libxml2-api.xml
|
||||||
-@(if [ "$(PYTHON)" != "" ] ; then $(PYTHON) $(srcdir)/gentest.py ; fi )
|
-@(if [ "$(PYTHON)" != "" ] ; then \
|
||||||
|
$(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
|
||||||
|
|
||||||
testapi_SOURCES=testapi.c
|
testapi_SOURCES=testapi.c
|
||||||
testapi_LDFLAGS =
|
testapi_LDFLAGS =
|
||||||
|
@ -26,7 +26,7 @@ EXTRA_DIST=xmlcatalog_man.xml tutorial/*.html tutorial/*.c tutorial/*.pdf \
|
|||||||
|
|
||||||
man_MANS = xmllint.1 xmlcatalog.1
|
man_MANS = xmllint.1 xmlcatalog.1
|
||||||
|
|
||||||
all: web $(top_srcdir)/NEWS libxml2.xsa $(man_MANS)
|
all: web $(top_builddir)/NEWS libxml2.xsa $(man_MANS)
|
||||||
|
|
||||||
api: libxml2-api.xml libxml2-refs.xml $(APIPAGES) $(srcdir)/html/index.html $(WIN32_DIR)/libxml2.def.src ../elfgcchack.h
|
api: libxml2-api.xml libxml2-refs.xml $(APIPAGES) $(srcdir)/html/index.html $(WIN32_DIR)/libxml2.def.src ../elfgcchack.h
|
||||||
|
|
||||||
@ -49,9 +49,9 @@ $(PAGES): xml.html site.xsl
|
|||||||
echo "Validating the HTML Web pages" ; \
|
echo "Validating the HTML Web pages" ; \
|
||||||
$(XMLLINT) --nonet --valid --noout $(PAGES) ; fi );
|
$(XMLLINT) --nonet --valid --noout $(PAGES) ; fi );
|
||||||
|
|
||||||
$(top_srcdir)/NEWS: $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html
|
$(top_builddir)/NEWS: $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html
|
||||||
-@(if [ -x $(XSLTPROC) ] ; then \
|
-@(if [ -x $(XSLTPROC) ] ; then \
|
||||||
$(XSLTPROC) --nonet $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html > $(top_srcdir)/NEWS ; fi );
|
$(XSLTPROC) --nonet $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html > $(top_builddir)/NEWS ; fi );
|
||||||
|
|
||||||
libxml2.xsa: $(top_srcdir)/doc/xsa.xsl $(top_srcdir)/doc/news.html
|
libxml2.xsa: $(top_srcdir)/doc/xsa.xsl $(top_srcdir)/doc/news.html
|
||||||
-@(if [ -x $(XSLTPROC) ] ; then \
|
-@(if [ -x $(XSLTPROC) ] ; then \
|
||||||
|
16
gentest.py
16
gentest.py
@ -11,6 +11,11 @@ except:
|
|||||||
print "libxml2 python bindings not available, skipping testapi.c generation"
|
print "libxml2 python bindings not available, skipping testapi.c generation"
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
srcPref = sys.argv[1] + '/'
|
||||||
|
else:
|
||||||
|
srcPref = ''
|
||||||
|
|
||||||
#
|
#
|
||||||
# Modules we want to skip in API test
|
# Modules we want to skip in API test
|
||||||
#
|
#
|
||||||
@ -425,17 +430,26 @@ def is_known_return_type(name):
|
|||||||
# Copy the beginning of the C test program result
|
# Copy the beginning of the C test program result
|
||||||
#
|
#
|
||||||
|
|
||||||
|
try:
|
||||||
input = open("testapi.c", "r")
|
input = open("testapi.c", "r")
|
||||||
|
except:
|
||||||
|
input = open(srcPref + "testapi.c", "r")
|
||||||
test = open('testapi.c.new', 'w')
|
test = open('testapi.c.new', 'w')
|
||||||
|
|
||||||
def compare_and_save():
|
def compare_and_save():
|
||||||
global test
|
global test
|
||||||
|
|
||||||
test.close()
|
test.close()
|
||||||
|
try:
|
||||||
input = open("testapi.c", "r").read()
|
input = open("testapi.c", "r").read()
|
||||||
|
except:
|
||||||
|
input = ''
|
||||||
test = open('testapi.c.new', "r").read()
|
test = open('testapi.c.new', "r").read()
|
||||||
if input != test:
|
if input != test:
|
||||||
|
try:
|
||||||
os.system("rm testapi.c; mv testapi.c.new testapi.c")
|
os.system("rm testapi.c; mv testapi.c.new testapi.c")
|
||||||
|
except:
|
||||||
|
os.system("mv testapi.c.new testapi.c")
|
||||||
print("Updated testapi.c")
|
print("Updated testapi.c")
|
||||||
else:
|
else:
|
||||||
print("Generated testapi.c is identical")
|
print("Generated testapi.c is identical")
|
||||||
@ -467,7 +481,7 @@ test.write("/* CUT HERE: everything below that line is generated */\n")
|
|||||||
#
|
#
|
||||||
# Open the input API description
|
# Open the input API description
|
||||||
#
|
#
|
||||||
doc = libxml2.readFile('doc/libxml2-api.xml', None, 0)
|
doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0)
|
||||||
if doc == None:
|
if doc == None:
|
||||||
print "Failed to load doc/libxml2-api.xml"
|
print "Failed to load doc/libxml2-api.xml"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -6,7 +6,8 @@ SUBDIRS= . tests
|
|||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
-I$(PYTHON_INCLUDES) \
|
-I$(PYTHON_INCLUDES) \
|
||||||
-I$(top_srcdir)/include \
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_builddir)/include
|
-I$(top_builddir)/include \
|
||||||
|
-I$(top_builddir)/$(subdir)
|
||||||
|
|
||||||
DOCS_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
|
DOCS_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
|
||||||
# libxml2class.txt is generated
|
# libxml2class.txt is generated
|
||||||
@ -37,8 +38,8 @@ python_LTLIBRARIES = libxml2mod.la
|
|||||||
libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c
|
libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c
|
||||||
libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@
|
libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@
|
||||||
|
|
||||||
libxml2.py: $(srcdir)/libxml.py $(srcdir)/libxml2class.py
|
libxml2.py: $(srcdir)/libxml.py libxml2class.py
|
||||||
cat $(srcdir)/libxml.py $(srcdir)/libxml2class.py > libxml2.py
|
cat $(srcdir)/libxml.py libxml2class.py > libxml2.py
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
$(mkinstalldirs) $(DESTDIR)$(pythondir)
|
$(mkinstalldirs) $(DESTDIR)$(pythondir)
|
||||||
@ -50,18 +51,18 @@ install-data-local:
|
|||||||
|
|
||||||
GENERATE = generator.py
|
GENERATE = generator.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= $(srcdir)/libxml2class.py \
|
GENERATED= libxml2class.py \
|
||||||
$(srcdir)/libxml2-export.c \
|
libxml2-export.c \
|
||||||
$(srcdir)/libxml2class.txt \
|
libxml2class.txt \
|
||||||
$(srcdir)/libxml2-py.c \
|
libxml2-py.c \
|
||||||
$(srcdir)/libxml2-py.h
|
libxml2-py.h
|
||||||
|
|
||||||
CLEANFILES= $(GENERATED) gen_prog libxml2.py
|
CLEANFILES= $(GENERATED) gen_prog libxml2.py
|
||||||
|
|
||||||
$(GENERATED): gen_prog
|
$(GENERATED): gen_prog
|
||||||
|
|
||||||
gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
|
gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
|
||||||
cd $(srcdir) && $(PYTHON) $(GENERATE)
|
$(PYTHON) $(srcdir)/$(GENERATE) $(srcdir)
|
||||||
touch gen_prog
|
touch gen_prog
|
||||||
|
|
||||||
$(libxml2mod_la_OBJECTS): $(GENERATED)
|
$(libxml2mod_la_OBJECTS): $(GENERATED)
|
||||||
|
@ -9,6 +9,11 @@ enums = {} # { enumType: { enumConstant: enumValue } }
|
|||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
srcPref = sys.argv[1] + '/'
|
||||||
|
else:
|
||||||
|
srcPref = ''
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#
|
#
|
||||||
# That part if purely the API acquisition phase from the
|
# That part if purely the API acquisition phase from the
|
||||||
@ -294,6 +299,10 @@ py_return_types = {
|
|||||||
|
|
||||||
unknown_types = {}
|
unknown_types = {}
|
||||||
|
|
||||||
|
foreign_encoding_args = (
|
||||||
|
'xmlCreateMemoryParserCtxt',
|
||||||
|
)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#
|
#
|
||||||
# This part writes the C <-> Python stubs libxml2-py.[ch] and
|
# This part writes the C <-> Python stubs libxml2-py.[ch] and
|
||||||
@ -382,6 +391,7 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
c_args=""
|
c_args=""
|
||||||
c_return=""
|
c_return=""
|
||||||
c_convert=""
|
c_convert=""
|
||||||
|
num_bufs=0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
# This should be correct
|
# This should be correct
|
||||||
if arg[1][0:6] == "const ":
|
if arg[1][0:6] == "const ":
|
||||||
@ -389,6 +399,11 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
c_args = c_args + " %s %s;\n" % (arg[1], arg[0])
|
c_args = c_args + " %s %s;\n" % (arg[1], arg[0])
|
||||||
if py_types.has_key(arg[1]):
|
if py_types.has_key(arg[1]):
|
||||||
(f, t, n, c) = py_types[arg[1]]
|
(f, t, n, c) = py_types[arg[1]]
|
||||||
|
if name == 'xmlCreateMemoryParserCtxt':
|
||||||
|
print "processing special case"
|
||||||
|
if (f == 'z') and (name in foreign_encoding_args):
|
||||||
|
f = 't#'
|
||||||
|
print "changed 'f'"
|
||||||
if f != None:
|
if f != None:
|
||||||
format = format + f
|
format = format + f
|
||||||
if t != None:
|
if t != None:
|
||||||
@ -399,6 +414,10 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
arg[1], t, arg[0]);
|
arg[1], t, arg[0]);
|
||||||
else:
|
else:
|
||||||
format_args = format_args + ", &%s" % (arg[0])
|
format_args = format_args + ", &%s" % (arg[0])
|
||||||
|
if f == 't#':
|
||||||
|
format_args = format_args + ", &py_buffsize%d" % num_bufs
|
||||||
|
c_args = c_args + " int py_buffsize%d;\n" % num_bufs
|
||||||
|
num_bufs = num_bufs + 1
|
||||||
if c_call != "":
|
if c_call != "":
|
||||||
c_call = c_call + ", ";
|
c_call = c_call + ", ";
|
||||||
c_call = c_call + "%s" % (arg[0])
|
c_call = c_call + "%s" % (arg[0])
|
||||||
@ -570,14 +589,14 @@ def buildStubs():
|
|||||||
global unknown_types
|
global unknown_types
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = open("libxml2-api.xml")
|
f = open(srcPref + "libxml2-api.xml")
|
||||||
data = f.read()
|
data = f.read()
|
||||||
(parser, target) = getparser()
|
(parser, target) = getparser()
|
||||||
parser.feed(data)
|
parser.feed(data)
|
||||||
parser.close()
|
parser.close()
|
||||||
except IOError, msg:
|
except IOError, msg:
|
||||||
try:
|
try:
|
||||||
f = open("../doc/libxml2-api.xml")
|
f = open(srcPref + "../doc/libxml2-api.xml")
|
||||||
data = f.read()
|
data = f.read()
|
||||||
(parser, target) = getparser()
|
(parser, target) = getparser()
|
||||||
parser.feed(data)
|
parser.feed(data)
|
||||||
@ -591,7 +610,7 @@ def buildStubs():
|
|||||||
|
|
||||||
py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject")
|
py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject")
|
||||||
try:
|
try:
|
||||||
f = open("libxml2-python-api.xml")
|
f = open(srcPref + "libxml2-python-api.xml")
|
||||||
data = f.read()
|
data = f.read()
|
||||||
(parser, target) = getparser()
|
(parser, target) = getparser()
|
||||||
parser.feed(data)
|
parser.feed(data)
|
||||||
|
Reference in New Issue
Block a user