[cairo-commit] pycairo ChangeLog, 1.235, 1.236 INSTALL, 1.6, 1.7 setup.py, 1.9, 1.10

Steve Chaplin commit at pdx.freedesktop.org
Sat Aug 19 06:14:47 PDT 2006


Committed by: stevech1097

Update of /cvs/cairo/pycairo
In directory kemper:/tmp/cvs-serv30899

Modified Files:
	ChangeLog INSTALL setup.py 
Log Message:
'SC'

Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/pycairo/ChangeLog,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -d -r1.235 -r1.236
--- ChangeLog	17 Aug 2006 15:48:09 -0000	1.235
+++ ChangeLog	19 Aug 2006 13:14:44 -0000	1.236
@@ -1,3 +1,9 @@
+2006-08-19  Steve Chaplin  <steve1097 # yahoo.com.au>
+
+	* INSTALL: add notes for new install method.
+
+	* setup.py : install pycairo.h and pycairo.pc files.
+
 2006-08-17  Steve Chaplin  <steve1097 # yahoo.com.au>
 
 	* setup.py: update so 'python setup.py install' can be used as an

Index: INSTALL
===================================================================
RCS file: /cvs/cairo/pycairo/INSTALL,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- INSTALL	14 Aug 2006 08:21:34 -0000	1.6
+++ INSTALL	19 Aug 2006 13:14:44 -0000	1.7
@@ -1,4 +1,6 @@
-Pycairo uses the same method of install as cairo - GNU autotools.
+Install method1 - preferred method
+---------------
+Using the same install method of install as cairo - GNU autotools.
 
     $ python -c "import sys; print sys.prefix"
       # make a note of the python prefix
@@ -19,3 +21,10 @@
 
 To disable PyGTK support use:
     $ ./configure --without-pygtk
+
+
+Install method2 - alternative install method
+---------------
+    1. Untar the .tar.gz file
+    2. cd into the resulting directory
+    3. python setup.py install

Index: setup.py
===================================================================
RCS file: /cvs/cairo/pycairo/setup.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- setup.py	17 Aug 2006 15:48:09 -0000	1.9
+++ setup.py	19 Aug 2006 13:14:44 -0000	1.10
@@ -1,31 +1,31 @@
 #!/usr/bin/env python
 
-import distutils.core as dic
+import distutils.core      as dic
+import distutils.dir_util  as dut
+import distutils.file_util as fut
 import os
+import sys
 
 pycairo_version        = '1.2.2'
 cairo_version_required = '1.2.2'
 
 # 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?
+# on Fedora Core 5 module is compiled with 'gcc -g' - why -g?
 # later: replace os.popen() with subprocess module, new in Python 2.4
 
+def pkg_config (opt, pkg):
+    fo = os.popen ('pkg-config %s %s' % (opt, pkg))
+    return fo.read(), fo.close()
+
 def pkg_config_version_check (pkg, version):
-    fo = os.popen('pkg-config --atleast-version=%s %s' % (version, pkg))
-    status = fo.close()
+    output, status = pkg_config ('--atleast-version=%s' % version, pkg)
     if status is None:
         print '%s version >= %s detected' % (pkg, version)
     else:
         raise SystemExit ('Error: %s version >= %s not found' % (pkg, version))
 
 def pkg_config_parse (opt, pkg):
-    output = os.popen('pkg-config %s %s' % (opt, pkg)).read()
+    output, status = pkg_config (opt, pkg)
     opt = opt[-2:]
     return [x.lstrip(opt) for x in output.split()]
 
@@ -45,6 +45,7 @@
     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'),
+    runtime_library_dirs = pkg_config_parse('--libs-only-L', 'cairo'),
     )
 
 dic.setup(
@@ -54,3 +55,24 @@
     packages = ['cairo'],
     ext_modules = [cairo],
     )
+
+pkgconfig_dir  = os.path.join (sys.prefix, 'lib', 'pkgconfig')
+pkgconfig_file = os.path.join (pkgconfig_dir, 'pycairo.pc')
+print 'creating %s' % pkgconfig_file
+fo = file (pkgconfig_file, 'w')
+fo.write ("""\
+prefix=%s
+
+Name: Pycairo
+Description: Python bindings for cairo
+Version: %s
+Requires: cairo
+Cflags: -I${prefix}/include/pycairo
+Libs:
+""" % (sys.prefix, pycairo_version)
+          )
+fo.close()
+
+includedir = os.path.join (sys.prefix, 'include', 'pycairo')
+dut.mkpath (includedir, verbose=True)
+fut.copy_file ('cairo/pycairo.h', includedir, verbose=True)



More information about the cairo-commit mailing list