torsava / rpms / python3

Forked from rpms/python3 6 years ago
Clone
1ae4dd3
diff -up Python-3.1.1/configure.in.expat Python-3.1.1/configure.in
1ae4dd3
--- Python-3.1.1/configure.in.expat	2010-01-25 23:02:05.488859572 -0500
1ae4dd3
+++ Python-3.1.1/configure.in	2010-01-25 23:02:21.425857866 -0500
1ae4dd3
@@ -1853,6 +1853,13 @@ LIBS="$withval $LIBS"
1ae4dd3
 ],
1ae4dd3
 [AC_MSG_RESULT(no)])
1ae4dd3
 
1ae4dd3
+# Check for use of the system expat library
1ae4dd3
+AC_MSG_CHECKING(for --with-system-expat)
1ae4dd3
+AC_ARG_WITH(system_expat,
1ae4dd3
+            AC_HELP_STRING(--with-system-expat, build pyexpat module using an installed expat library))
1ae4dd3
+
1ae4dd3
+AC_MSG_RESULT($with_system_expat)
1ae4dd3
+
1ae4dd3
 # Check for use of the system libffi library
1ae4dd3
 AC_MSG_CHECKING(for --with-system-ffi)
1ae4dd3
 AC_ARG_WITH(system_ffi,
1ae4dd3
diff -up Python-3.1.1/setup.py.expat Python-3.1.1/setup.py
1ae4dd3
--- Python-3.1.1/setup.py.expat	2010-01-25 23:02:11.254859198 -0500
1ae4dd3
+++ Python-3.1.1/setup.py	2010-01-25 23:02:21.426857993 -0500
1ae4dd3
@@ -1110,19 +1110,26 @@ class PyBuildExt(build_ext):
1ae4dd3
         #
1ae4dd3
         # More information on Expat can be found at www.libexpat.org.
1ae4dd3
         #
1ae4dd3
-        expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
1ae4dd3
-        define_macros = [
1ae4dd3
-            ('HAVE_EXPAT_CONFIG_H', '1'),
1ae4dd3
-        ]
1ae4dd3
+        if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
1ae4dd3
+            expat_inc = []
1ae4dd3
+            define_macros = []
1ae4dd3
+            expat_lib = ['expat']
1ae4dd3
+            expat_sources = []
1ae4dd3
+        else:
1ae4dd3
+            expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')]
1ae4dd3
+            define_macros = [
1ae4dd3
+                ('HAVE_EXPAT_CONFIG_H', '1'),
1ae4dd3
+            ]
1ae4dd3
+            expat_lib = []
1ae4dd3
+            expat_sources = ['expat/xmlparse.c',
1ae4dd3
+                             'expat/xmlrole.c',
1ae4dd3
+                             'expat/xmltok.c']
1ae4dd3
 
1ae4dd3
         exts.append(Extension('pyexpat',
1ae4dd3
                               define_macros = define_macros,
1ae4dd3
-                              include_dirs = [expatinc],
1ae4dd3
-                              sources = ['pyexpat.c',
1ae4dd3
-                                         'expat/xmlparse.c',
1ae4dd3
-                                         'expat/xmlrole.c',
1ae4dd3
-                                         'expat/xmltok.c',
1ae4dd3
-                                         ],
1ae4dd3
+                              include_dirs = expat_inc,
1ae4dd3
+                              libraries = expat_lib,
1ae4dd3
+                              sources = ['pyexpat.c'] + expat_sources
1ae4dd3
                               ))
1ae4dd3
 
1ae4dd3
         # Fredrik Lundh's cElementTree module.  Note that this also
1ae4dd3
@@ -1132,7 +1139,8 @@ class PyBuildExt(build_ext):
1ae4dd3
             define_macros.append(('USE_PYEXPAT_CAPI', None))
1ae4dd3
             exts.append(Extension('_elementtree',
1ae4dd3
                                   define_macros = define_macros,
1ae4dd3
-                                  include_dirs = [expatinc],
1ae4dd3
+                                  include_dirs = expat_inc,
1ae4dd3
+                                  libraries = expat_lib,
1ae4dd3
                                   sources = ['_elementtree.c'],
1ae4dd3
                                   ))
1ae4dd3
         else: