summaryrefslogtreecommitdiffstats
path: root/dsextras.py
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@wingware.com>2006-04-18 21:41:01 +0000
committerJohn Ehresman <jpe@src.gnome.org>2006-04-18 21:41:01 +0000
commit04d884d38999150d993f48c205e2f6c8dda81b3e (patch)
tree40054ca28110f8355314e2168fc84f1623b85f56 /dsextras.py
parent63cc4251f90a0a49abec4470aa43df6f64761865 (diff)
downloadpygobject-04d884d38999150d993f48c205e2f6c8dda81b3e.tar.gz
pygobject-04d884d38999150d993f48c205e2f6c8dda81b3e.tar.xz
pygobject-04d884d38999150d993f48c205e2f6c8dda81b3e.zip
Add compiler / linker flags from pkgconfig-2.0.pc by default, with an
2006-04-18 John Ehresman <jpe@wingware.com> * 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
Diffstat (limited to 'dsextras.py')
-rw-r--r--dsextras.py17
1 files changed, 17 insertions, 0 deletions
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']