06633bbc98
This package provides python bindings for cairo library. It is built with gtk support. From Eric Faurot <eric.faurot@gmail.com>
88 lines
3.0 KiB
Plaintext
88 lines
3.0 KiB
Plaintext
--- setup.py.orig Fri Oct 7 17:22:14 2005
|
|
+++ setup.py Fri Oct 7 17:45:39 2005
|
|
@@ -1,42 +1,49 @@
|
|
#!/usr/bin/env python
|
|
-
|
|
+import os
|
|
from distutils.core import setup, Extension
|
|
|
|
-def pkg_config_parse(pkg, opt):
|
|
- import os
|
|
- conf = os.popen('pkg-config %s %s' % (opt,pkg)).read()
|
|
- opt = opt[-2:]
|
|
- return [x.lstrip(opt) for x in conf.split()]
|
|
+def pkgconfig(opt, *pkgs):
|
|
+ r = []
|
|
+ for pkg in pkgs:
|
|
+ conf = os.popen('pkg-config %s %s' % (opt,pkg)).read()
|
|
+ r.extend([ x[2:] for x in conf.split() ])
|
|
+ return r
|
|
|
|
-def get_include(pkg):
|
|
- return pkg_config_parse(pkg,'--cflags-only-I')
|
|
+modules = [
|
|
+ Extension(name = 'cairo._cairo',
|
|
+ sources = ['cairo/cairomodule.c',
|
|
+ 'cairo/pycairo-context.c',
|
|
+ 'cairo/pycairo-font.c',
|
|
+ 'cairo/pycairo-matrix.c',
|
|
+ 'cairo/pycairo-path.c',
|
|
+ 'cairo/pycairo-pattern.c',
|
|
+ 'cairo/pycairo-surface.c',
|
|
+ ],
|
|
+ include_dirs = pkgconfig('--cflags-only-I', 'cairo'),
|
|
+ library_dirs = pkgconfig('--libs-only-L', 'cairo'),
|
|
+ libraries = pkgconfig('--libs-only-l', 'cairo'),
|
|
+ )
|
|
+ ]
|
|
|
|
-def get_lib_dirs(pkg):
|
|
- return pkg_config_parse(pkg,'--libs-only-L')
|
|
+#modules.append(Extension(
|
|
+# name = 'cairo.svg',
|
|
+# sources = ['cairo/cairosvgmodule.c'],
|
|
+# include_dirs = pkgconfig('--cflags-only-I', 'libsvg-cairo'),
|
|
+# library_dirs = pkgconfig('--libs-only-L', 'libsvg-cairo'),
|
|
+# libraries = pkgconfig('--libs-only-l', 'libsvg-cairo')))
|
|
|
|
-def get_libs(pkg):
|
|
- return pkg_config_parse(pkg,'--libs-only-l')
|
|
+modules.append(Extension(
|
|
+ name = 'cairo.gtk',
|
|
+ sources = ['cairo/cairogtkmodule.c'],
|
|
+ include_dirs = pkgconfig('--cflags-only-I', 'gtk+-2.0', 'pygtk-2.0', 'cairo'),
|
|
+ library_dirs = pkgconfig('--libs-only-L', 'pygtk-2.0'),
|
|
+ libraries = pkgconfig('--libs-only-l', 'pygtk-2.0')))
|
|
|
|
-#~ print get_include('cairo')
|
|
-#~ print get_lib_dirs('cairo')
|
|
-#~ print get_libs('cairo')
|
|
-
|
|
-_cairo = Extension(name = 'cairo._cairo',
|
|
- sources= ['cairo/cairomodule.c',
|
|
- 'cairo/pycairo-context.c', 'cairo/pycairo-font.c',
|
|
- 'cairo/pycairo-matrix.c', 'cairo/pycairo-path.c',
|
|
- 'cairo/pycairo-pattern.c', 'cairo/pycairo-surface.c',
|
|
- ],
|
|
- include_dirs = get_include('cairo'),
|
|
- library_dirs = get_lib_dirs('cairo'),
|
|
- libraries = get_libs('cairo'),
|
|
- )
|
|
-
|
|
-setup( name = "pycairo",
|
|
- version = "1.0.2",
|
|
- description = "python interface for cairo",
|
|
-
|
|
- packages = ['cairo'],
|
|
- ext_modules = [_cairo],
|
|
- )
|
|
-
|
|
+setup(name = "pycairo",
|
|
+ version = "1.0.2",
|
|
+ description = "python interface for cairo",
|
|
+ packages = ['cairo'],
|
|
+ ext_modules = modules,
|
|
+ data_files = [ [ 'include/pycairo', [ 'cairo/pycairo.h',
|
|
+# 'cairo/pycairosvg.h',
|
|
+ ] ]])
|