[XML-SIG] Patch to 0.6.4 to add --with-libexpat and --ldflags

xml-sig@thewrittenword.com xml-sig@thewrittenword.com
Mon, 5 Mar 2001 10:51:42 -0600


Patch to add command-line arguments --with-libexpat=PATH to specify
location of libexpat include/lib files and --ldflags=STR to add
arbitrary linker flags to build the resulting object file (on some
systems, need to set runtime path to the libexpat shared library).

-- 
albert chin (china@thewrittenword.com)

-- snip snip
--- setup.py.orig	Thu Mar  1 11:45:51 2001
+++ setup.py	Thu Mar  1 12:01:45 2001
@@ -35,6 +35,19 @@
     def xml(s):
         return "_xmlplus"+s
 
+# special command-line arguments
+LIBEXPAT = None
+LDFLAGS = []
+
+args = sys.argv[:]
+for arg in args:
+    if string.find(arg, '--with-libexpat=') == 0:
+        LIBEXPAT = string.split(arg, '=')[1]
+        sys.argv.remove(arg)
+    elif string.find(arg, '--ldflags=') == 0:
+        LDFLAGS = string.split(string.split(arg, '=')[1])
+        sys.argv.remove(arg)
+
 def should_build_pyexpat():
     try:
         import pyexpat
@@ -56,6 +69,9 @@
         return 0
 
 def get_expat_prefix():
+    if LIBEXPAT:
+        return LIBEXPAT
+
     for p in ("/usr", "/usr/local"):
         incs = os.path.join(p, "include")
         libs = os.path.join(p, "lib")
@@ -100,6 +116,7 @@
                       include_dirs=include_dirs,
                       library_dirs=library_dirs,
                       libraries=libraries,
+                      extra_link_args=LDFLAGS,
                       sources=sources
                       ))