Mercurial > cpython-lru_cache-weakref
diff setup.py @ 58024:8fee2ab53e71 legacy-trunk
add a --with-system-expat option to build pyexpat against the system's lib #7609
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Thu, 31 Dec 2009 03:17:18 +0000 |
| parents | e53e55252ba8 |
| children | 7d6bff722195 |
line wrap: on
line diff
--- a/setup.py Wed Dec 30 19:44:23 2009 +0000 +++ b/setup.py Thu Dec 31 03:17:18 2009 +0000 @@ -1220,19 +1220,26 @@ # # More information on Expat can be found at www.libexpat.org. # - expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat') - define_macros = [ - ('HAVE_EXPAT_CONFIG_H', '1'), - ] + if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"): + expat_inc = [] + define_macros = [] + expat_lib = ['expat'] + expat_sources = [] + else: + expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')] + define_macros = [ + ('HAVE_EXPAT_CONFIG_H', '1'), + ] + expat_lib = [] + expat_sources = ['expat/xmlparse.c', + 'expat/xmlrole.c', + 'expat/xmltok.c'] exts.append(Extension('pyexpat', define_macros = define_macros, - include_dirs = [expatinc], - sources = ['pyexpat.c', - 'expat/xmlparse.c', - 'expat/xmlrole.c', - 'expat/xmltok.c', - ], + include_dirs = expat_inc, + libraries = expat_lib, + sources = ['pyexpat.c'] + expat_sources )) # Fredrik Lundh's cElementTree module. Note that this also @@ -1242,7 +1249,8 @@ define_macros.append(('USE_PYEXPAT_CAPI', None)) exts.append(Extension('_elementtree', define_macros = define_macros, - include_dirs = [expatinc], + include_dirs = expat_inc, + libraries = expat_lib, sources = ['_elementtree.c'], )) else:
