summaryrefslogtreecommitdiff
path: root/gentest.py
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2004-12-23 15:56:12 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2004-12-23 15:56:12 +0000
commit106cad66199aced3f7ae0e943ed7e740179c51eb (patch)
treee55dffbf62a440d6558ca76b59064326dbcfa1c0 /gentest.py
parentb759b30587a61b7b366969333c03ddcbdc046dec (diff)
downloadlibxml2-106cad66199aced3f7ae0e943ed7e740179c51eb.tar.gz
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).
Diffstat (limited to 'gentest.py')
-rwxr-xr-xgentest.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/gentest.py b/gentest.py
index fb37eda4..38630afe 100755
--- a/gentest.py
+++ b/gentest.py
@@ -11,6 +11,11 @@ except:
print "libxml2 python bindings not available, skipping testapi.c generation"
sys.exit(0)
+if len(sys.argv) > 1:
+ srcPref = sys.argv[1] + '/'
+else:
+ srcPref = ''
+
#
# 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
#
-input = open("testapi.c", "r")
+try:
+ input = open("testapi.c", "r")
+except:
+ input = open(srcPref + "testapi.c", "r")
test = open('testapi.c.new', 'w')
def compare_and_save():
global test
test.close()
- input = open("testapi.c", "r").read()
+ try:
+ input = open("testapi.c", "r").read()
+ except:
+ input = ''
test = open('testapi.c.new', "r").read()
if input != test:
- os.system("rm testapi.c ; mv testapi.c.new testapi.c")
+ try:
+ os.system("rm testapi.c; mv testapi.c.new testapi.c")
+ except:
+ os.system("mv testapi.c.new testapi.c")
print("Updated testapi.c")
else:
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
#
-doc = libxml2.readFile('doc/libxml2-api.xml', None, 0)
+doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0)
if doc == None:
print "Failed to load doc/libxml2-api.xml"
sys.exit(1)