if '--enable-threading' in sys.argv: sys.argv.remove('--enable-threading') try: import thread thread # pyflakes except ImportError: print('* Could not import thread module, disabling threading.') enable_threading = False else: enable_threading = True if enable_threading: name = 'gthread-%s' % PYGTK_SUFFIX for module in ext_modules: raw = getoutput('pkg-config --libs-only-l %s' % name) for arg in raw.split(): if arg.startswith('-l'): module.libraries.append(arg[2:]) else: module.extra_link_args.append(arg) raw = getoutput('pkg-config --cflags-only-I %s' % name) for arg in raw.split(): if arg.startswith('-I'): module.include_dirs.append(arg[2:]) else: module.extra_compile_args.append(arg) else:
#!/usr/bin/python2.5 import sys import glob from distutils.core import setup sys.path.append("/usr/share/pygtk/2.0") from dsextras import BuildExt, TemplateExtension, getoutput defsdir = getoutput("pkg-config --variable=defsdir pygtk-2.0") extensions = [] hildon = TemplateExtension( name="hildon", pkc_name="hildon-1", pkc_version="2.1.42", pygobject_pkc=( "hildon-fm-2", "pygobject-2.0", "gconf-2.0", # needed by hildon-fm-2 (see MB#4538) "gnome-vfs-2.0", # needed by hildon-fm-2 (see MB#4538) ), sources=[ "hildonmodule.c", "hildon.c", "hildon-types.c", ], defs="hildon.defs", override="hildon.override", register=[ defsdir + "/gtk-types.defs",
enable_threading = False else: if '--enable-threading' in sys.argv: sys.argv.remove('--enable-threading') try: import thread except ImportError: print ('* Could not import thread module, disabling threading') enable_threading = False else: enable_threading = True if enable_threading: name = 'gthread-%s' % PYGTK_SUFFIX for module in ext_modules: raw = getoutput('pkg-config --libs-only-l %s' % name) for arg in raw.split(): if arg.startswith('-l'): module.libraries.append(arg[2:]) else: module.extra_link_args.append(arg) raw = getoutput('pkg-config --cflags-only-I %s' % name) for arg in raw.split(): if arg.startswith('-I'): module.include_dirs.append(arg[2:]) else: module.extra_compile_args.append(arg) else: GLOBAL_MACROS.append(('DISABLE_THREADING', 1)) doclines = __doc__.split('\n')
def run(self): self.add_template_option('VERSION', VERSION) self.prepare() self.install_template('mate-python-2.0.pc.in', os.path.join(self.libdir, 'pkgconfig')) # Modify the base installation dir install_dir = os.path.join(self.install_dir, PYGTK_SUFFIX_LONG) self.set_install_dir(install_dir) InstallLib.run(self) if not pkgc_version_check('pygtk-2.0', 'PyGTK', PYGTK_REQUIRED_VERSION): raise SystemExit, "Aborting" pygtkincludedir = getoutput('pkg-config --variable pygtkincludedir pygtk-2.0') codegendir = getoutput('pkg-config --variable codegendir pygtk-2.0') defsdir = getoutput('pkg-config --variable defsdir pygtk-2.0') GLOBAL_INC.append(pygtkincludedir) GTKDEFS = [os.path.join(defsdir, 'pango-types.defs'), os.path.join(defsdir, 'gdk-types.defs'), os.path.join(defsdir, 'gtk-types.defs')] MATECOMPONENTDEFS = [os.path.join('matecomponent', 'matecomponent-types.defs'), os.path.join('matecomponent', 'matecomponentui-types.defs')] CANVASDEFS = [os.path.join('mate', 'canvas.defs')] sys.path.append(codegendir) try: from override import Overrides except ImportError: raise SystemExit, \
self.add_template_option('VERSION', VERSION) self.prepare() self.install_template('mate-python-2.0.pc.in', os.path.join(self.libdir, 'pkgconfig')) # Modify the base installation dir install_dir = os.path.join(self.install_dir, PYGTK_SUFFIX_LONG) self.set_install_dir(install_dir) InstallLib.run(self) if not pkgc_version_check('pygtk-2.0', 'PyGTK', PYGTK_REQUIRED_VERSION): raise SystemExit, "Aborting" pygtkincludedir = getoutput('pkg-config --variable pygtkincludedir pygtk-2.0') codegendir = getoutput('pkg-config --variable codegendir pygtk-2.0') defsdir = getoutput('pkg-config --variable defsdir pygtk-2.0') GLOBAL_INC.append(pygtkincludedir) GTKDEFS = [ os.path.join(defsdir, 'pango-types.defs'), os.path.join(defsdir, 'gdk-types.defs'), os.path.join(defsdir, 'gtk-types.defs') ] MATECOMPONENTDEFS = [ os.path.join('matecomponent', 'matecomponent-types.defs'), os.path.join('matecomponent', 'matecomponentui-types.defs') ] CANVASDEFS = [os.path.join('mate', 'canvas.defs')] sys.path.append(codegendir)
return True compile_args = [ '-Os', '-DXTHREADS', '-DXUSE_MTSAFE_API', # '-ansi', # '-pedantic', # '-Wno-long-long', # '-g', # '-rdynamic', ] include_flags = getoutput( 'pkg-config --cflags conic dbus-1 dbus-glib-1 glib-2.0 gobject-2.0 pygtk-2.0' ).split(' ') compile_args.extend(include_flags) # Using get_includes plus pygtk headers conic = Extension( 'conic', sources=[ 'conic.c', 'conicmodule.c', 'conic-types.c', ], libraries=[ 'conic', 'dbus-1', 'dbus-glib-1',