libvips/swig/python/setup.py.in

81 lines
2.1 KiB
Python
Raw Normal View History

2010-05-05 17:22:04 +02:00
#!/usr/bin/python
2010-05-06 15:37:57 +02:00
# vim: set fileencoding=latin-1:
2010-05-05 17:22:04 +02:00
import re
import sys
from distutils.core import setup, Extension
# We pick up configure's stuff here. Sadly distutils needs this broken out
# into separate includes, libs and defines, argh
2010-05-06 15:37:57 +02:00
configure_flags = '@VIPS_CFLAGS@ @VIPS_INCLUDES@ @VIPS_LIBS@ -I@top_srcdir@/libvips/include -I@top_srcdir@/libvipsCC/include'
2010-05-05 17:22:04 +02:00
# Parse compiler flags into these categories, yuk!
configure_macros = []
configure_include_dirs = []
configure_library_dirs = []
configure_libs = []
configure_options = []
for flag in configure_flags.split():
match = re.match ('-D(.*)(=(.*))?', flag)
if match:
key = match.group (1)
if match.group (2):
value = match.group (2)
else:
value = 1
configure_macros += [(key, value)]
continue
match = re.match ('-I(.*)', flag)
if match:
configure_include_dirs += [match.group (1)]
continue
match = re.match ('-L(.*)', flag)
if match:
configure_library_dirs += [match.group (1)]
continue
match = re.match ('-l(.*)', flag)
if match:
configure_libs += [match.group (1)]
continue
match = re.match ('-(.*)', flag)
if match:
configure_options += [flag]
continue
print '%s: unknown configure option!' % flag
sys.exit (1)
def make_extension (name, source):
return Extension (name,
2010-05-06 15:37:57 +02:00
sources = [source],
2010-05-05 17:22:04 +02:00
define_macros = configure_macros,
2010-05-06 15:37:57 +02:00
include_dirs = configure_include_dirs,
libraries = configure_libs,
library_dirs = configure_library_dirs,
2010-05-05 17:22:04 +02:00
extra_compile_args = configure_options,
extra_link_args = configure_options,
runtime_library_dirs= ['@IM_LIBDIR@'])
2010-05-06 15:37:57 +02:00
module1 = make_extension ('vimagemodule', 'vimagemodule.cpp')
module2 = make_extension ('vmaskmodule', 'vmaskmodule.cpp')
module3 = make_extension ('verrormodule', 'verrormodule.cpp')
module4 = make_extension ('vdisplaymodule', 'vdisplaymodule.cpp')
2010-05-05 17:22:04 +02:00
setup (name = 'vipsCC',
version = '7.20.7',
description = 'vips-7.x image processing library',
2010-05-06 15:37:57 +02:00
author = 'Jos<EFBFBD> Mar<61>a Garc<72>a P<>rez, John Cupitt',
2010-05-05 17:22:04 +02:00
author_email = 'jcupitt@gmail.com',
url = 'http://www.vips.ecs.soton.ac.uk',
2010-05-06 15:37:57 +02:00
packages = ['vipsCC'],
2010-05-05 17:22:04 +02:00
ext_package = 'vipsCC',
2010-05-06 15:37:57 +02:00
ext_modules = [module1, module2, module3, module4])
2010-05-05 17:22:04 +02:00