py_buffer_len
+ if self._for_html:
+ error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)
+ else:
+ error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)
+ py_buffer_len -= buffer_len
+ c_data += buffer_len
if error and not pctxt.replaceEntities and not pctxt.validate:
# in this mode, we ignore errors about undefined entities
From scoder at codespeak.net Sat Jan 30 21:39:55 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 21:39:55 +0100 (CET)
Subject: [Lxml-checkins] r71001 - in lxml/trunk: . src/lxml
Message-ID: <20100130203955.DA5A21680AB@codespeak.net>
Author: scoder
Date: Sat Jan 30 21:39:55 2010
New Revision: 71001
Modified:
lxml/trunk/ (props changed)
lxml/trunk/src/lxml/iterparse.pxi
Log:
r5440 at lenny: sbehnel | 2010-01-30 21:12:44 +0100
streamlined __next__ method in iterparse()
Modified: lxml/trunk/src/lxml/iterparse.pxi
==============================================================================
--- lxml/trunk/src/lxml/iterparse.pxi (original)
+++ lxml/trunk/src/lxml/iterparse.pxi Sat Jan 30 21:39:55 2010
@@ -457,24 +457,26 @@
def __next__(self):
cdef _IterparseContext context
- cdef xmlparser.xmlParserCtxt* pctxt
- cdef cstd.FILE* c_stream
- cdef char* c_data
- cdef Py_ssize_t c_data_len
- cdef int error, done
if self._source is None:
raise StopIteration
context = <_IterparseContext>self._push_parser_context
- if python.PyList_GET_SIZE(context._events) > context._event_index:
- item = python.PyList_GET_ITEM(context._events, context._event_index)
- python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM
- context._event_index += 1
- return item
+ if python.PyList_GET_SIZE(context._events) <= context._event_index:
+ self._read_more_events(context)
+ item = python.PyList_GET_ITEM(context._events, context._event_index)
+ python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM
+ context._event_index += 1
+ return item
+
+ cdef _read_more_events(self, _IterparseContext context):
+ cdef cstd.FILE* c_stream
+ cdef char* c_data
+ cdef Py_ssize_t c_data_len
+ cdef xmlparser.xmlParserCtxt* pctxt = context._c_ctxt
+ cdef int error = 0, done = 0
del context._events[:]
- pctxt = context._c_ctxt
- error = done = 0
+ context._event_index = 0
c_stream = python.PyFile_AsFile(self._source)
while python.PyList_GET_SIZE(context._events) == 0:
if c_stream is NULL:
@@ -518,11 +520,6 @@
self._source = None
raise StopIteration
- context._event_index = 1
- element = python.PyList_GET_ITEM(context._events, 0)
- python.Py_INCREF(element) # 'borrowed reference' from PyList_GET_ITEM
- return element
-
cdef class iterwalk:
u"""iterwalk(self, element_or_tree, events=("end",), tag=None)
From scoder at codespeak.net Sat Jan 30 21:40:01 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 21:40:01 +0100 (CET)
Subject: [Lxml-checkins] r71003 - in lxml/trunk: . src/lxml
Message-ID: <20100130204001.C1F1F1680AF@codespeak.net>
Author: scoder
Date: Sat Jan 30 21:39:59 2010
New Revision: 71003
Modified:
lxml/trunk/ (props changed)
lxml/trunk/CHANGES.txt
lxml/trunk/src/lxml/xmlerror.pxi
Log:
r5441 at lenny: sbehnel | 2010-01-30 21:18:09 +0100
support passing a logger into PyErrorLog instead of just its name
Modified: lxml/trunk/CHANGES.txt
==============================================================================
--- lxml/trunk/CHANGES.txt (original)
+++ lxml/trunk/CHANGES.txt Sat Jan 30 21:39:59 2010
@@ -8,6 +8,9 @@
Features added
--------------
+* Support passing a readily configured logger instance into
+ ``PyErrorLog``, instead of a logger name.
+
* On serialisation, the new ``doctype`` parameter can be used to
override the DOCTYPE (internal subset) of the document.
Modified: lxml/trunk/src/lxml/xmlerror.pxi
==============================================================================
--- lxml/trunk/src/lxml/xmlerror.pxi (original)
+++ lxml/trunk/src/lxml/xmlerror.pxi Sat Jan 30 21:39:59 2010
@@ -360,10 +360,11 @@
self._entries.append(entry)
cdef class PyErrorLog(_BaseErrorLog):
- u"""PyErrorLog(self, logger_name=None)
+ u"""PyErrorLog(self, logger_name=None, logger=None)
A global error log that connects to the Python stdlib logging package.
- The constructor accepts an optional logger name.
+ The constructor accepts an optional logger name or a readily
+ instantiated logger instance.
If you want to change the mapping between libxml2's ErrorLevels and Python
logging levels, you can modify the level_map dictionary from a subclass.
@@ -378,10 +379,10 @@
object and calls ``self.log(log_entry, format_string, arg1, arg2, ...)``
with appropriate data.
"""
- cdef readonly object level_map
+ cdef readonly dict level_map
cdef object _map_level
cdef object _log
- def __init__(self, logger_name=None):
+ def __init__(self, logger_name=None, logger=None):
_BaseErrorLog.__init__(self, None, None)
import logging
self.level_map = {
@@ -390,10 +391,11 @@
ErrorLevels.FATAL : logging.CRITICAL
}
self._map_level = self.level_map.get
- if logger_name:
- logger = logging.getLogger(logger_name)
- else:
- logger = logging.getLogger()
+ if logger is None:
+ if logger_name:
+ logger = logging.getLogger(logger_name)
+ else:
+ logger = logging.getLogger()
self._log = logger.log
def copy(self):
From scoder at codespeak.net Sat Jan 30 21:40:05 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 21:40:05 +0100 (CET)
Subject: [Lxml-checkins] r71004 - in lxml/trunk: . doc
Message-ID: <20100130204005.6B36D1680C1@codespeak.net>
Author: scoder
Date: Sat Jan 30 21:40:04 2010
New Revision: 71004
Modified:
lxml/trunk/ (props changed)
lxml/trunk/doc/elementsoup.txt
Log:
r5442 at lenny: sbehnel | 2010-01-30 21:39:43 +0100
test fix: looks like BS can't handle broken 'HTML' after all
Modified: lxml/trunk/doc/elementsoup.txt
==============================================================================
--- lxml/trunk/doc/elementsoup.txt (original)
+++ lxml/trunk/doc/elementsoup.txt Sat Jan 30 21:40:04 2010
@@ -47,7 +47,7 @@
.. sourcecode:: pycon
- >>> tag_soup = 'HelloHi all'
+ >>> tag_soup = '
HelloHi all'
all you need to do is pass it to the ``fromstring()`` function:
From scoder at codespeak.net Sat Jan 30 21:41:42 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 21:41:42 +0100 (CET)
Subject: [Lxml-checkins] r71005 - lxml/branch/lxml-2.2/doc
Message-ID: <20100130204142.2C01F1680AB@codespeak.net>
Author: scoder
Date: Sat Jan 30 21:41:41 2010
New Revision: 71005
Modified:
lxml/branch/lxml-2.2/doc/elementsoup.txt
Log:
test fix
Modified: lxml/branch/lxml-2.2/doc/elementsoup.txt
==============================================================================
--- lxml/branch/lxml-2.2/doc/elementsoup.txt (original)
+++ lxml/branch/lxml-2.2/doc/elementsoup.txt Sat Jan 30 21:41:41 2010
@@ -47,7 +47,7 @@
.. sourcecode:: pycon
- >>> tag_soup = '
HelloHi all'
+ >>> tag_soup = '
HelloHi all'
all you need to do is pass it to the ``fromstring()`` function:
From scoder at codespeak.net Sat Jan 30 21:42:18 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 21:42:18 +0100 (CET)
Subject: [Lxml-checkins] r71006 - lxml/branch/lxml-2.2/src/lxml
Message-ID: <20100130204218.430A21680AB@codespeak.net>
Author: scoder
Date: Sat Jan 30 21:42:17 2010
New Revision: 71006
Modified:
lxml/branch/lxml-2.2/src/lxml/cleanup.pxi
Log:
build fix for Cython 0.11.3
Modified: lxml/branch/lxml-2.2/src/lxml/cleanup.pxi
==============================================================================
--- lxml/branch/lxml-2.2/src/lxml/cleanup.pxi (original)
+++ lxml/branch/lxml-2.2/src/lxml/cleanup.pxi Sat Jan 30 21:42:17 2010
@@ -243,7 +243,9 @@
if c_child.type == tree.XML_ELEMENT_NODE:
for i in range(c_tag_count):
if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
- c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
+ c_next = _findChildForwards(c_child, 0)
+ if c_next is NULL:
+ c_next = _nextElement(c_child)
_replaceNodeByChildren(doc, c_child)
if not attemptDeallocation(c_child):
if c_child.nsDef is not NULL:
From scoder at codespeak.net Sat Jan 30 21:52:48 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 21:52:48 +0100 (CET)
Subject: [Lxml-checkins] r71008 - in lxml/trunk: . src/lxml/tests
Message-ID: <20100130205248.976C81680AB@codespeak.net>
Author: scoder
Date: Sat Jan 30 21:52:48 2010
New Revision: 71008
Modified:
lxml/trunk/ (props changed)
lxml/trunk/src/lxml/tests/test_objectify.py
Log:
r5450 at lenny: sbehnel | 2010-01-30 21:52:34 +0100
test case for lxml.objectify bug
Modified: lxml/trunk/src/lxml/tests/test_objectify.py
==============================================================================
--- lxml/trunk/src/lxml/tests/test_objectify.py (original)
+++ lxml/trunk/src/lxml/tests/test_objectify.py Sat Jan 30 21:52:48 2010
@@ -2384,6 +2384,18 @@
self.assert_(isinstance(root.value[0], objectify.IntElement))
self.assert_(isinstance(root.value[1], objectify.FloatElement))
+ def test_efactory_subtype(self):
+ class Attribute(objectify.ObjectifiedDataElement):
+ def __init__(self):
+ objectify.ObjectifiedDataElement.__init__(self)
+ self.set("datatype", "TYPE")
+ self.set("range", "0.,1.")
+
+ attr = Attribute()
+ self.assertEquals(attr.text, None)
+ self.assertEquals(attr.get("datatype"), "TYPE")
+ self.assertEquals(attr.get("range"), "0.,1.")
+
def test_XML_base_url_docinfo(self):
root = objectify.XML(_bytes(""), base_url="http://no/such/url")
docinfo = root.getroottree().docinfo
From scoder at codespeak.net Sat Jan 30 21:53:23 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 21:53:23 +0100 (CET)
Subject: [Lxml-checkins] r71009 - in lxml/branch/lxml-2.2: . src/lxml/tests
Message-ID: <20100130205323.76A35168016@codespeak.net>
Author: scoder
Date: Sat Jan 30 21:53:22 2010
New Revision: 71009
Modified:
lxml/branch/lxml-2.2/ (props changed)
lxml/branch/lxml-2.2/INSTALL.txt (props changed)
lxml/branch/lxml-2.2/src/lxml/tests/test_objectify.py
Log:
merged test case from trunk
Modified: lxml/branch/lxml-2.2/src/lxml/tests/test_objectify.py
==============================================================================
--- lxml/branch/lxml-2.2/src/lxml/tests/test_objectify.py (original)
+++ lxml/branch/lxml-2.2/src/lxml/tests/test_objectify.py Sat Jan 30 21:53:22 2010
@@ -2384,6 +2384,18 @@
self.assert_(isinstance(root.value[0], objectify.IntElement))
self.assert_(isinstance(root.value[1], objectify.FloatElement))
+ def test_efactory_subtype(self):
+ class Attribute(objectify.ObjectifiedDataElement):
+ def __init__(self):
+ objectify.ObjectifiedDataElement.__init__(self)
+ self.set("datatype", "TYPE")
+ self.set("range", "0.,1.")
+
+ attr = Attribute()
+ self.assertEquals(attr.text, None)
+ self.assertEquals(attr.get("datatype"), "TYPE")
+ self.assertEquals(attr.get("range"), "0.,1.")
+
def test_XML_base_url_docinfo(self):
root = objectify.XML(_bytes(""), base_url="http://no/such/url")
docinfo = root.getroottree().docinfo
From scoder at codespeak.net Sat Jan 30 22:37:52 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 22:37:52 +0100 (CET)
Subject: [Lxml-checkins] r71010 - in lxml/trunk: . src/lxml/html
Message-ID: <20100130213752.9890C1680C1@codespeak.net>
Author: scoder
Date: Sat Jan 30 22:37:51 2010
New Revision: 71010
Modified:
lxml/trunk/ (props changed)
lxml/trunk/src/lxml/html/html5parser.py
Log:
r5454 at lenny: sbehnel | 2010-01-30 22:10:29 +0100
bug #511252: fix fragment parsing in html5parser.py
Modified: lxml/trunk/src/lxml/html/html5parser.py
==============================================================================
--- lxml/trunk/src/lxml/html/html5parser.py (original)
+++ lxml/trunk/src/lxml/html/html5parser.py Sat Jan 30 22:37:51 2010
@@ -94,14 +94,19 @@
if not isinstance(html, _strings):
raise TypeError('string required')
- if create_parent:
- container = create_parent or 'div'
- html = '<%s>%s%s>' % (container, html, container)
-
children = fragments_fromstring(html, True, guess_charset, parser)
if not children:
raise etree.ParserError('No elements found')
- if len(children) > 1:
+ if create_parent:
+ if not isinstance(create_parent, _strings):
+ create_parent = 'div'
+ new_root = Element(create_parent)
+ if isinstance(children[0], _strings):
+ new_root.text = children[0]
+ del children[0]
+ new_root.extend(children)
+ children = new_root
+ elif len(children) > 1:
raise etree.ParserError('Multiple elements found')
result = children[0]
From scoder at codespeak.net Sat Jan 30 22:37:57 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 22:37:57 +0100 (CET)
Subject: [Lxml-checkins] r71011 - in lxml/trunk: . src/lxml/html
Message-ID: <20100130213757.9EF3B1680F2@codespeak.net>
Author: scoder
Date: Sat Jan 30 22:37:56 2010
New Revision: 71011
Modified:
lxml/trunk/ (props changed)
lxml/trunk/CHANGES.txt
lxml/trunk/src/lxml/html/html5parser.py
Log:
r5455 at lenny: sbehnel | 2010-01-30 22:37:46 +0100
bug #511252: fix fragment parsing in lxml.html
Modified: lxml/trunk/CHANGES.txt
==============================================================================
--- lxml/trunk/CHANGES.txt (original)
+++ lxml/trunk/CHANGES.txt Sat Jan 30 22:37:56 2010
@@ -55,6 +55,9 @@
Bugs fixed
----------
+* Parsing broken fragments in lxml.html could fail if the fragment
+ contained an orphaned closing '' tag.
+
* Manually instantiating the custom element classes in
``lxml.objectify`` could crash.
Modified: lxml/trunk/src/lxml/html/html5parser.py
==============================================================================
--- lxml/trunk/src/lxml/html/html5parser.py (original)
+++ lxml/trunk/src/lxml/html/html5parser.py Sat Jan 30 22:37:56 2010
@@ -89,27 +89,34 @@
element.
If create_parent is true (or is a tag name) then a parent node
- will be created to encapsulate the HTML in a single element.
+ will be created to encapsulate the HTML in a single element. In
+ this case, leading or trailing text is allowed.
"""
if not isinstance(html, _strings):
raise TypeError('string required')
- children = fragments_fromstring(html, True, guess_charset, parser)
- if not children:
- raise etree.ParserError('No elements found')
+ accept_leading_text = bool(create_parent)
+
+ elements = fragments_fromstring(
+ html, guess_charset=guess_charset, parser=parser,
+ no_leading_text=not accept_leading_text, **kw)
+
if create_parent:
- if not isinstance(create_parent, _strings):
+ if not isinstance(create_parent, basestring):
create_parent = 'div'
new_root = Element(create_parent)
- if isinstance(children[0], _strings):
- new_root.text = children[0]
- del children[0]
- new_root.extend(children)
- children = new_root
- elif len(children) > 1:
- raise etree.ParserError('Multiple elements found')
+ if elements:
+ if isinstance(elements[0], basestring):
+ new_root.text = elements[0]
+ del elements[0]
+ new_root.extend(elements)
+ return new_root
- result = children[0]
+ if not elements:
+ raise etree.ParserError('No elements found')
+ if len(elements) > 1:
+ raise etree.ParserError('Multiple elements found')
+ result = elements[0]
if result.tail and result.tail.strip():
raise etree.ParserError('Element followed by text: %r' % result.tail)
result.tail = None
From scoder at codespeak.net Sat Jan 30 22:52:14 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 22:52:14 +0100 (CET)
Subject: [Lxml-checkins] r71012 - in lxml/trunk: . src/lxml/html
Message-ID: <20100130215214.15CD91680C1@codespeak.net>
Author: scoder
Date: Sat Jan 30 22:52:13 2010
New Revision: 71012
Modified:
lxml/trunk/ (props changed)
lxml/trunk/src/lxml/html/__init__.py
Log:
r5459 at lenny: sbehnel | 2010-01-30 22:52:08 +0100
bug #511252: fix fragment parsing in lxml.html
Modified: lxml/trunk/src/lxml/html/__init__.py
==============================================================================
--- lxml/trunk/src/lxml/html/__init__.py (original)
+++ lxml/trunk/src/lxml/html/__init__.py Sat Jan 30 22:52:13 2010
@@ -577,23 +577,33 @@
element.
If create_parent is true (or is a tag name) then a parent node
- will be created to encapsulate the HTML in a single element.
+ will be created to encapsulate the HTML in a single element. In
+ this case, leading or trailing text is allowed.
base_url will set the document's base_url attribute (and the tree's docinfo.URL)
"""
if parser is None:
parser = html_parser
+
+ accept_leading_text = bool(create_parent)
+
+ elements = fragments_fromstring(
+ html, parser=parser, no_leading_text=not accept_leading_text,
+ base_url=base_url, **kw)
+
if create_parent:
if not isinstance(create_parent, basestring):
create_parent = 'div'
- return fragment_fromstring('<%s>%s%s>' % (
- create_parent, html, create_parent),
- parser=parser, base_url=base_url, **kw)
- elements = fragments_fromstring(html, parser=parser, no_leading_text=True,
- base_url=base_url, **kw)
+ new_root = Element(create_parent)
+ if elements:
+ if isinstance(elements[0], basestring):
+ new_root.text = elements[0]
+ del elements[0]
+ new_root.extend(elements)
+ return new_root
+
if not elements:
- raise etree.ParserError(
- "No elements found")
+ raise etree.ParserError('No elements found')
if len(elements) > 1:
raise etree.ParserError(
"Multiple elements found (%s)"
From scoder at codespeak.net Sat Jan 30 23:02:48 2010
From: scoder at codespeak.net (scoder at codespeak.net)
Date: Sat, 30 Jan 2010 23:02:48 +0100 (CET)
Subject: [Lxml-checkins] r71013 - lxml/trunk
Message-ID: <20100130220248.557391680AB@codespeak.net>
Author: scoder
Date: Sat Jan 30 23:02:47 2010
New Revision: 71013
Modified:
lxml/trunk/ (props changed)
lxml/trunk/CHANGES.txt
lxml/trunk/buildlibxml.py
lxml/trunk/setupinfo.py
Log:
r5461 at lenny: sbehnel | 2010-01-30 23:02:39 +0100
bug #506558: applied patch by Sridhar Ratnakumar to download Windows dependency binaries during build
Modified: lxml/trunk/CHANGES.txt
==============================================================================
--- lxml/trunk/CHANGES.txt (original)
+++ lxml/trunk/CHANGES.txt Sat Jan 30 23:02:47 2010
@@ -94,6 +94,9 @@
Other changes
-------------
+* Static MS Windows builds can now download their dependencies
+ themselves.
+
* ``Element.attrib`` no longer uses a cyclic reference back to its
Element object. It therefore no longer requires the garbage
collector to clean up.
Modified: lxml/trunk/buildlibxml.py
==============================================================================
--- lxml/trunk/buildlibxml.py (original)
+++ lxml/trunk/buildlibxml.py Sat Jan 30 23:02:47 2010
@@ -7,8 +7,63 @@
except ImportError:
from urllib.parse import urlsplit
from urllib.request import urlretrieve
+
+
-## Routines to download and build libxml2/xslt:
+# use pre-built libraries on Windows
+
+def download_and_extract_zlatkovic_binaries(destdir):
+ url = 'ftp://ftp.zlatkovic.com/pub/libxml/'
+ libs = dict(
+ libxml2 = None,
+ libxslt = None,
+ zlib = None,
+ iconv = None,
+ )
+ for fn in ftp_listdir(url):
+ for libname in libs:
+ if fn.startswith(libname):
+ assert libs[libname] is None, 'duplicate listings?'
+ assert fn.endswith('.win32.zip')
+ libs[libname] = fn
+
+ if not os.path.exists(destdir): os.makedirs(destdir)
+ for libname, libfn in libs.items():
+ srcfile = urljoin(url, libfn)
+ destfile = os.path.join(destdir, libfn)
+ print('Retrieving "%s" to "%s"' % (srcfile, destfile))
+ urlretrieve(srcfile, destfile)
+ d = unpack_zipfile(destfile, destdir)
+ libs[libname] = d
+
+ return libs
+
+def unpack_zipfile(zipfn, destdir):
+ assert zipfn.endswith('.zip')
+ import zipfile
+ print('Unpacking %s into %s' % (os.path.basename(zipfn), destdir))
+ f = zipfile.ZipFile(zipfn)
+ try:
+ f.extractall(path=destdir)
+ finally:
+ f.close()
+ edir = os.path.join(destdir, os.path.basename(zipfn)[:-len('.zip')])
+ assert os.path.exists(edir), 'missing: %s' % edir
+ return edir
+
+def get_prebuilt_libxml2xslt(download_dir, static_include_dirs, static_library_dirs):
+ assert sys.platform.startswith('win')
+ libs = download_and_extract_zlatkovic_binaries(download_dir)
+ for libname, path in libs.items():
+ i = os.path.join(path, 'include')
+ l = os.path.join(path, 'lib')
+ assert os.path.exists(i), 'does not exist: %s' % i
+ assert os.path.exists(l), 'does not exist: %s' % l
+ static_include_dirs.append(i)
+ static_library_dirs.append(l)
+
+
+## Routines to download and build libxml2/xslt from sources:
LIBXML2_LOCATION = 'ftp://xmlsoft.org/libxml2/'
LIBICONV_LOCATION = 'ftp://ftp.gnu.org/pub/gnu/libiconv/'
Modified: lxml/trunk/setupinfo.py
==============================================================================
--- lxml/trunk/setupinfo.py (original)
+++ lxml/trunk/setupinfo.py Sat Jan 30 23:02:47 2010
@@ -41,14 +41,19 @@
static_cflags, static_binaries):
global XML2_CONFIG, XSLT_CONFIG
if OPTION_BUILD_LIBXML2XSLT:
- from buildlibxml import build_libxml2xslt
- XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
- 'libs', 'build/tmp',
- static_include_dirs, static_library_dirs,
- static_cflags, static_binaries,
- libiconv_version=OPTION_LIBICONV_VERSION,
- libxml2_version=OPTION_LIBXML2_VERSION,
- libxslt_version=OPTION_LIBXSLT_VERSION)
+ from buildlibxml import build_libxml2xslt, get_prebuilt_libxml2xslt
+ if sys.platform.startswith('win'):
+ get_prebuilt_libxml2xslt(
+ 'libs', static_include_dirs, static_library_dirs)
+ else:
+ XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
+ 'libs', 'build/tmp',
+ static_include_dirs, static_library_dirs,
+ static_cflags, static_binaries,
+ libiconv_version=OPTION_LIBICONV_VERSION,
+ libxml2_version=OPTION_LIBXML2_VERSION,
+ libxslt_version=OPTION_LIBXSLT_VERSION)
+
if CYTHON_INSTALLED:
source_extension = ".pyx"
print("Building with Cython %s." % Cython.Compiler.Version.version)
@@ -321,6 +326,7 @@
env_val = os.getenv(name.upper().replace('-', '_'))
return env_val
+staticbuild = bool(os.environ.get('STATICBUILD', ''))
# pick up any commandline options and/or env variables
OPTION_WITHOUT_OBJECTIFY = has_option('without-objectify')
OPTION_WITHOUT_ASSERT = has_option('without-assert')
@@ -329,11 +335,11 @@
OPTION_WITH_REFNANNY = has_option('with-refnanny')
if OPTION_WITHOUT_CYTHON:
CYTHON_INSTALLED = False
-OPTION_STATIC = has_option('static')
+OPTION_STATIC = staticbuild or has_option('static')
OPTION_DEBUG_GCC = has_option('debug-gcc')
OPTION_SHOW_WARNINGS = has_option('warnings')
OPTION_AUTO_RPATH = has_option('auto-rpath')
-OPTION_BUILD_LIBXML2XSLT = has_option('static-deps')
+OPTION_BUILD_LIBXML2XSLT = staticbuild or has_option('static-deps')
if OPTION_BUILD_LIBXML2XSLT:
OPTION_STATIC = True
OPTION_LIBXML2_VERSION = option_value('libxml2-version')