[Lxml-checkins] r51348 - lxml/trunk
scoder at codespeak.net
scoder at codespeak.net
Fri Feb 8 20:40:07 CET 2008
Author: scoder
Date: Fri Feb 8 20:40:06 2008
New Revision: 51348
Modified:
lxml/trunk/ (props changed)
lxml/trunk/setupinfo.py
Log:
r3449 at delle: sbehnel | 2008-02-08 20:38:10 +0100
support overriding xslt-config in setup.py: --with-xslt-config=XXX
Modified: lxml/trunk/setupinfo.py
==============================================================================
--- lxml/trunk/setupinfo.py (original)
+++ lxml/trunk/setupinfo.py Fri Feb 8 20:40:06 2008
@@ -81,7 +81,7 @@
return static_library_dirs
# filter them from xslt-config --libs
result = []
- possible_library_dirs = flags('xslt-config --libs')
+ possible_library_dirs = flags('libs')
for possible_library_dir in possible_library_dirs:
if possible_library_dir.startswith('-L'):
result.append(possible_library_dir[2:])
@@ -95,7 +95,7 @@
return static_include_dirs
# filter them from xslt-config --cflags
result = []
- possible_include_dirs = flags('xslt-config --cflags')
+ possible_include_dirs = flags('cflags')
for possible_include_dir in possible_include_dirs:
if possible_include_dir.startswith('-I'):
result.append(possible_include_dir[2:])
@@ -114,7 +114,7 @@
return result
# anything from xslt-config --cflags that doesn't start with -I
- possible_cflags = flags('xslt-config --cflags')
+ possible_cflags = flags('cflags')
for possible_cflag in possible_cflags:
if not possible_cflag.startswith('-I'):
result.append(possible_cflag)
@@ -127,8 +127,9 @@
if OPTION_WITHOUT_THREADING:
macros.append(('WITHOUT_THREADING', None))
return macros
-
-def flags(cmd):
+
+def flags(option):
+ cmd = "%s --%s" % (find_xslt_config(), option)
try:
import subprocess
except ImportError:
@@ -145,6 +146,22 @@
print("** make sure the development packages of libxml2 and libxslt are installed **\n")
return str(rf.read()).split()
+XSLT_CONFIG = None
+
+def find_xslt_config():
+ global XSLT_CONFIG
+ if XSLT_CONFIG:
+ return XSLT_CONFIG
+ option = '--with-xslt-config='
+ for arg in sys.argv:
+ if arg.startswith(option):
+ sys.argv.remove(arg)
+ XSLT_CONFIG = arg[len(option):]
+ return XSLT_CONFIG
+ else:
+ XSLT_CONFIG = 'xslt-config'
+ return XSLT_CONFIG
+
def has_option(name):
try:
sys.argv.remove('--%s' % name)
More information about the lxml-checkins
mailing list