# So to avoid any problems, remove anything kaa from the path, since we don't # need it. [sys.path.remove(x) for x in sys.path[:] if '/kaa' in x and x != os.getcwd()] # Now import the src directory and masquerade it as kaa and kaa.base modules so # we can import distribution.core. import src sys.modules['kaa'] = sys.modules['kaa.base'] = src # And now import it from the source tree. from kaa.distribution.core import Extension, setup extensions = [] objectrow_ext = Extension('kaa.base._objectrow', ['src/extensions/objectrow.c']) if objectrow_ext.has_python_h(): extensions.append(objectrow_ext) if sys.hexversion < 0x02060000: # Fixed os.listdir for Python 2.5. This module is optional for Python 2.5 # (only installed if headers/libs are available) and not compiled for later # versions. utils_ext = Extension('kaa.base._utils', ['src/extensions/utils.c']) if utils_ext.has_python_h(): extensions.append(utils_ext) # Automagically construct version. If installing from a git clone, the # version is based on the number of revisions since the last tag. Otherwise, # if PKG-INFO exists, assume it's a dist tarball and pull the version from # that.
# # So to avoid any problems, remove anything kaa from the path, since we don't # need it. [sys.path.remove(x) for x in sys.path[:] if '/kaa' in x and x != os.getcwd()] # Now import the src directory and masquerade it as kaa and kaa.base modules so # we can import distribution.core. import src sys.modules['kaa'] = sys.modules['kaa.base'] = src # And now import it from the source tree. from kaa.distribution.core import Extension, setup extensions = [] objectrow_ext = Extension('kaa.base._objectrow', ['src/extensions/objectrow.c']) if objectrow_ext.has_python_h(): extensions.append(objectrow_ext) # Automagically construct version. If installing from a git clone, the # version is based on the number of revisions since the last tag. Otherwise, # if PKG-INFO exists, assume it's a dist tarball and pull the version from # that. version = VERSION if os.path.isdir('.git'): # Fetch all revisions since last tag. The first item is the current HEAD object name # and the last is the tag object name. revs = os.popen( 'git rev-list --all | grep -B9999 `git rev-list --tags --max-count=1`' ).read().splitlines() if len(revs) > 1:
setup(name='kaa-' + MODULE, version=VERSION, install_requires=REQUIRES) sys.exit(0) try: # kaa base imports from kaa.distribution.core import Extension, setup except ImportError: print 'kaa.base not installed' sys.exit(1) files = [ 'src/imlib2.c', 'src/image.c', 'src/font.c', 'src/rawformats.c' ] libraries = [] if not os.uname()[0] in ('FreeBSD', 'Darwin'): libraries.append('rt') imlib2so = Extension('kaa.imlib2._Imlib2module', files, libraries = libraries, config='src/config.h') if not imlib2so.check_library('imlib2', '1.2.1'): print 'Imlib2 >= 1.2.1 not found' print 'Download from http://enlightenment.freedesktop.org/' sys.exit(1) if imlib2so.check_cc(['<fcntl.h>'], 'shm_open("foobar");', '-lrt'): imlib2so.config('#define HAVE_POSIX_SHMEM') print "POSIX shared memory enabled" else: print "POSIX shared memory disabled" if imlib2so.check_library("librsvg-2.0", "2.10.0"):
# We require python 2.5 or later, so complain if that isn't satisfied. if sys.version.split()[0] < '2.5': print "Python 2.5 or later required." sys.exit(1) try: # kaa base imports from kaa.distribution.core import Extension, setup except ImportError, e: print e print 'kaa.base not installed' sys.exit(1) thumb_ext = Extension("kaa.beacon.libthumb", ["src/extensions/libthumb.c", "src/extensions/libpng.c"], config='src/extensions/config.h') if not thumb_ext.check_library('imlib2', '1.1.1'): print 'Imlib2 >= 1.1.1 not found' print 'Download from http://enlightenment.freedesktop.org/' sys.exit(1) if not thumb_ext.check_library('libpng', '1.2.0'): print 'libpng >= 1.2.0 not found' sys.exit(1) if thumb_ext.check_cc([], '', '-ljpeg'): thumb_ext.files.append('src/extensions/epeg.c') thumb_ext.libraries.append('jpeg') thumb_ext.config('#define USE_EPEG')