[Lxml-checkins] r52383 - lxml/trunk

scoder at codespeak.net scoder at codespeak.net
Tue Mar 11 18:38:32 CET 2008


Author: scoder
Date: Tue Mar 11 18:38:32 2008
New Revision: 52383

Modified:
   lxml/trunk/   (props changed)
   lxml/trunk/setupinfo.py
Log:
 r3756 at delle:  sbehnel | 2008-03-11 18:37:41 +0100
 print library version and library dirs at build time as a hint (not only) to MacOS-X users


Modified: lxml/trunk/setupinfo.py
==============================================================================
--- lxml/trunk/setupinfo.py	(original)
+++ lxml/trunk/setupinfo.py	Tue Mar 11 18:38:32 2008
@@ -29,12 +29,25 @@
     else:
         modules = EXT_MODULES
 
+    lib_version = libxslt_version()
+    print("Using build configuration of libxslt %s" % lib_version)
+
     _include_dirs = include_dirs(static_include_dirs)
     _library_dirs = library_dirs(static_library_dirs)
     _cflags = cflags(static_cflags)
     _define_macros = define_macros()
     _libraries = libraries()
 
+    if _library_dirs:
+        message = "Building against libxml2/libxslt in "
+        if len(_library_dirs) > 1:
+            print(message + "one of the following directories:")
+            for dir in _library_dirs:
+                print("  " + dir)
+        else:
+            print(message + "the following directory: " +
+                  _library_dirs[0])
+
     if OPTION_AUTO_RPATH:
         runtime_library_dirs = _library_dirs
     else:
@@ -128,8 +141,7 @@
         macros.append(('WITHOUT_THREADING', None))
     return macros
 
-def flags(option):
-    cmd = "%s --%s" % (find_xslt_config(), option)
+def run_command(cmd):
     try:
         import subprocess
     except ImportError:
@@ -141,10 +153,21 @@
                              stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         rf, ef = p.stdout, p.stderr
     errors = ef.read()
+    output = rf.read()
+    return output or '', errors or ''
+
+def libxslt_version():
+    cmd = "%s --version" % find_xslt_config()
+    output, errors = run_command(cmd)
     if errors:
         print("ERROR: %s" % errors)
         print("** make sure the development packages of libxml2 and libxslt are installed **\n")
-    return str(rf.read()).split()
+    return output.strip()
+
+def flags(option):
+    cmd = "%s --%s" % (find_xslt_config(), option)
+    output, _ = run_command(cmd)
+    return output.split()
 
 XSLT_CONFIG = None
 


More information about the lxml-checkins mailing list