[cairo-commit] pycairo ChangeLog,1.265,1.266 setup.py,1.18,1.19

Steve Chaplin commit at pdx.freedesktop.org
Tue Nov 20 01:16:12 PST 2007


Committed by: stevech1097

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

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

Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/pycairo/ChangeLog,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -d -r1.265 -r1.266
--- ChangeLog	6 Apr 2007 08:38:44 -0000	1.265
+++ ChangeLog	20 Nov 2007 09:16:09 -0000	1.266
@@ -1,3 +1,9 @@
+2007-11-20  Steven Chaplin  <steve1097 # yahoo.com.au>
+
+	* setup.py: update to use subprocess, and require Python 2.4
+
+	* cairo/pycairo-matrix.c (matrix_as_number): fix a compiler warning.
+
 2007-04-06  Steve Chaplin  <steve1097 # yahoo.com.au>
 
 	* configure.ac (AC_PROG_LIBTOOL): Add version number required (as a

Index: setup.py
===================================================================
RCS file: /cvs/cairo/pycairo/setup.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- setup.py	14 Mar 2007 09:47:35 -0000	1.18
+++ setup.py	20 Nov 2007 09:16:10 -0000	1.19
@@ -3,7 +3,7 @@
 import distutils.core      as dic
 import distutils.dir_util  as dut
 import distutils.file_util as fut
-import os
+import subprocess
 import sys
 
 pycairo_version        = '1.4.1'
@@ -11,25 +11,33 @@
 
 # Notes:
 # 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 call(command):
+    pipe = subprocess.Popen(command, shell=True,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.PIPE)
+    pipe.wait()
+    return pipe
 
-def pkg_config_version_check (pkg, version):
-    output, status = pkg_config ('--atleast-version=%s' % version, pkg)
-    if status is None:
-        print '%s version >= %s detected' % (pkg, version)
+def pkg_config_version_check(pkg, version):
+    pipe = call("pkg-config --print-errors --exists '%s >= %s'" %
+                (pkg, version))
+    if pipe.returncode == 0:
+        print '%s >= %s detected' % (pkg, version)
     else:
-        raise SystemExit ('Error: %s version >= %s not found' % (pkg, version))
+        print pipe.stderr.read()
+        raise SystemExit('Error: %s >= %s not found' % (pkg, version))
 
-def pkg_config_parse (opt, pkg):
-    output, status = pkg_config (opt, pkg)
+def pkg_config_parse(opt, pkg):
+    pipe = call("pkg-config %s %s" % (opt, pkg))
+    output = pipe.stdout.read()
     opt = opt[-2:]
     return [x.lstrip(opt) for x in output.split()]
 
 
+if sys.version_info < (2,4):
+    raise SystemExit('Error: Python >= 2.4 is required')
+
 pkg_config_version_check ('cairo', cairo_version_required)
 if sys.platform == 'win32':
     runtime_library_dirs = []



More information about the cairo-commit mailing list