From 04d884d38999150d993f48c205e2f6c8dda81b3e Mon Sep 17 00:00:00 2001 From: John Ehresman Date: Tue, 18 Apr 2006 21:41:01 +0000 Subject: Add compiler / linker flags from pkgconfig-2.0.pc by default, with an 2006-04-18 John Ehresman * dsextras.py: Add compiler / linker flags from pkgconfig-2.0.pc by default, with an override mechanism. Filter out -lc & -lm if compiling with msvc. * setup.py: Change C extension name to _gobject and don't use the pkgconfig-2.0.pc when compiling --- ChangeLog | 9 +++++++++ dsextras.py | 17 +++++++++++++++++ setup.py | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ca99507..b87b4b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-04-18 John Ehresman + + * dsextras.py: Add compiler / linker flags from pkgconfig-2.0.pc + by default, with an override mechanism. Filter out -lc & -lm if + compiling with msvc. + + * setup.py: Change C extension name to _gobject and don't use the + pkgconfig-2.0.pc when compiling + 2006-04-15 Gustavo J. A. M. Carneiro * gobject/__init__.py (_PyGObject_API): Copy _PyGObject_API from diff --git a/dsextras.py b/dsextras.py index 9caac13..0f8fa62 100644 --- a/dsextras.py +++ b/dsextras.py @@ -137,8 +137,17 @@ class BuildExt(build_ext): # Generate eventual templates before building if hasattr(ext, 'generate'): ext.generate() + # Filter out 'c' and 'm' libs when compilic w/ msvc + if sys.platform == 'win32' and self.compiler.compiler_type == 'msvc': + save_libs = ext.libraries + ext.libraries = [lib for lib in ext.libraries + if lib not in ['c', 'm']] + else: + save_libs = ext.libraries # Invoke base build_extension() build_ext.build_extension(self, ext) + if save_libs != None and save_libs != ext.libraries: + ext.libraries = save_libs class InstallLib(install_lib): @@ -208,6 +217,8 @@ class InstallData(install_data): return install_lib.get_inputs(self) + self.local_inputs class PkgConfigExtension(Extension): + # Name of pygobject package extension depends on, can be None + pygobject_pkc = 'pygobject-2.0' can_build_ok = None def __init__(self, **kwargs): name = kwargs['pkc_name'] @@ -215,6 +226,12 @@ class PkgConfigExtension(Extension): kwargs['define_macros'] = GLOBAL_MACROS kwargs['libraries'] = self.get_libraries(name) kwargs['library_dirs'] = self.get_library_dirs(name) + if 'pygobject_pkc' in kwargs: + self.pygobject_pkc = kwargs.pop('pygobject_pkc') + if self.pygobject_pkc: + kwargs['include_dirs'] += self.get_include_dirs(self.pygobject_pkc) + kwargs['libraries'] += self.get_libraries(self.pygobject_pkc) + kwargs['library_dirs'] += self.get_library_dirs(self.pygobject_pkc) self.name = kwargs['name'] self.pkc_name = kwargs['pkc_name'] self.pkc_version = kwargs['pkc_version'] diff --git a/setup.py b/setup.py index 6922995..2aaaadf 100755 --- a/setup.py +++ b/setup.py @@ -105,8 +105,9 @@ PyGObjectBuild.user_options.append(('enable-threading', None, 'enable threading support')) # GObject -gobject = PkgConfigExtension(name='gobject', pkc_name='gobject-2.0', +gobject = PkgConfigExtension(name='_gobject', pkc_name='gobject-2.0', pkc_version=GOBJECT_REQUIRED, + pygobject_pkc=None, sources=['gobject/gobjectmodule.c', 'gobject/pygboxed.c', 'gobject/pygenum.c', -- cgit