library-web r486 - in trunk: . src
- From: fpeters svn gnome org
- To: svn-commits-list gnome org
- Subject: library-web r486 - in trunk: . src
- Date: Tue, 26 Aug 2008 20:13:13 +0000 (UTC)
Author: fpeters
Date: Tue Aug 26 20:13:13 2008
New Revision: 486
URL: http://svn.gnome.org/viewvc/library-web?rev=486&view=rev
Log:
* src/lgo.py: added manual detection of XInclude errors, as a
workaround to improper xsltproc error code; thanks to hints from
Stefan Kost. (closes: #544356)
Modified:
trunk/ChangeLog
trunk/src/lgo.py
Modified: trunk/src/lgo.py
==============================================================================
--- trunk/src/lgo.py (original)
+++ trunk/src/lgo.py Tue Aug 26 20:13:13 2008
@@ -585,10 +585,15 @@
self.gtkdoc_xsl_file,
os.path.join(ext_dirname, self.dirname, main_sgml_file)]
logging.debug('executing %s' % ' '.join(cmd))
- rc = subprocess.call(cmd)
- if rc != 0:
- logging.warn('%s failed with error %d' % (' '.join(cmd), rc))
- if rc == 6:
+ xsltproc = subprocess.Popen(cmd, stdin = subprocess.PIPE, stderr = subprocess.PIPE)
+ stdout, stderr = xsltproc.communicate()
+ if re.findall('XInclude error : could not load.*and no fallback was found', stderr):
+ logging.warn('XInclude error, creating fake xsltproc return code')
+ xsltproc.returncode = 6
+
+ if xsltproc.returncode != 0:
+ logging.warn('%s failed with error %d' % (' '.join(cmd), xsltproc.returncode))
+ if xsltproc.returncode == 6:
# build failed, probably because it has inline references in
# documentation and would require a full module build to get
# them properly. (happens with GTK+)
@@ -608,10 +613,11 @@
if not filename.endswith('.html'):
open(dst, 'w').write(open(src, 'r').read())
continue
+ print src
doc = parser.parse(open(src))
doc.childNodes[-1].attributes['xmlns'] = 'http://www.w3.org/1999/xhtml'
temporary = tempfile.NamedTemporaryFile()
- temporary.write(doc.toxml())
+ temporary.write(doc.childNodes[-1].toxml().encode('utf-8'))
temporary.flush()
cmd = ['xsltproc', '--output', dst,
@@ -1129,7 +1135,7 @@
doc = parser.parse(open(src))
doc.childNodes[-1].attributes['xmlns'] = 'http://www.w3.org/1999/xhtml'
temporary = tempfile.NamedTemporaryFile()
- temporary.write(doc.toxml())
+ temporary.write(doc.childNodes[-1].toxml().encode('utf-8'))
temporary.flush()
cmd = ['xsltproc', '--output', dst,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]