[cairo-commit] pycairo ChangeLog,1.234,1.235 setup.py,1.8,1.9
Steve Chaplin
commit at pdx.freedesktop.org
Thu Aug 17 08:48:11 PDT 2006
Committed by: stevech1097
Update of /cvs/cairo/pycairo
In directory kemper:/tmp/cvs-serv30947
Modified Files:
ChangeLog setup.py
Log Message:
'SC'
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/pycairo/ChangeLog,v
retrieving revision 1.234
retrieving revision 1.235
diff -u -d -r1.234 -r1.235
--- ChangeLog 16 Aug 2006 14:32:46 -0000 1.234
+++ ChangeLog 17 Aug 2006 15:48:09 -0000 1.235
@@ -1,3 +1,8 @@
+2006-08-17 Steve Chaplin <steve1097 # yahoo.com.au>
+
+ * setup.py: update so 'python setup.py install' can be used as an
+ alternative install method.
+
2006-08-16 Steve Chaplin <steve1097 # yahoo.com.au>
* cairo/__init__.py: add new file
Index: setup.py
===================================================================
RCS file: /cvs/cairo/pycairo/setup.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- setup.py 3 Jul 2006 03:46:35 -0000 1.8
+++ setup.py 17 Aug 2006 15:48:09 -0000 1.9
@@ -1,42 +1,56 @@
#!/usr/bin/env python
-from distutils.core import setup, Extension
+import distutils.core as dic
+import os
-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()]
+pycairo_version = '1.2.2'
+cairo_version_required = '1.2.2'
-def get_include(pkg):
- return pkg_config_parse(pkg,'--cflags-only-I')
+# Notes:
+# need to install /<prefix>/include/pycairo/pycairo.h
+# /<prefix>/lib/pkgconfig/pycairo.pc
+# prefix defaults to /usr
+# distutils.dir_util.mkpath()
+# distutils.file_util.copy_file()
+#
+# on Fedora Core 5 it gets compiled with 'gcc -g' - why -g?
+# later: replace os.popen() with subprocess module, new in Python 2.4
-def get_lib_dirs(pkg):
- return pkg_config_parse(pkg,'--libs-only-L')
+def pkg_config_version_check (pkg, version):
+ fo = os.popen('pkg-config --atleast-version=%s %s' % (version, pkg))
+ status = fo.close()
+ if status is None:
+ print '%s version >= %s detected' % (pkg, version)
+ else:
+ raise SystemExit ('Error: %s version >= %s not found' % (pkg, version))
-def get_libs(pkg):
- return pkg_config_parse(pkg,'--libs-only-l')
+def pkg_config_parse (opt, pkg):
+ output = os.popen('pkg-config %s %s' % (opt, pkg)).read()
+ opt = opt[-2:]
+ return [x.lstrip(opt) for x in output.split()]
-#~ 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'),
- )
+pkg_config_version_check ('cairo', cairo_version_required)
-setup( name = "pycairo",
- version = "1.2.0",
- description = "python interface for cairo",
+cairo = dic.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 = pkg_config_parse('--cflags-only-I', 'cairo'),
+ library_dirs = pkg_config_parse('--libs-only-L', 'cairo'),
+ libraries = pkg_config_parse('--libs-only-l', 'cairo'),
+ )
+dic.setup(
+ name = "pycairo",
+ version = pycairo_version,
+ description = "python interface for cairo",
packages = ['cairo'],
- ext_modules = [_cairo],
+ ext_modules = [cairo],
)
-
More information about the cairo-commit
mailing list