Author: dmeyer
Date: Sun May 20 20:25:01 2007
New Revision: 2676

Modified:
   trunk/base/setup.py
   trunk/base/src/distribution/core.py

Log:
add has_python_h function in core to check for Python.h

Modified: trunk/base/setup.py
==============================================================================
--- trunk/base/setup.py (original)
+++ trunk/base/setup.py Sun May 20 20:25:01 2007
@@ -28,9 +28,7 @@
 
 # python imports
 import sys
-import os
 import time
-import distutils.sysconfig
 
 # We require python 2.4 or later, so complain if that isn't satisfied.
 if sys.version.split()[0] < '2.4':
@@ -44,38 +42,39 @@
 from distribution.core import Extension, setup
 
 ext = Extension('kaa.shmmodule', ['src/extensions/shmmodule.c'])
-extensions = [ ext ]
+if not ext.has_python_h():
+    print 
"---------------------------------------------------------------------"
+    print "Python headers not found; please install python development 
package."
+    print "kaa.db, shm and inotify support will be unavailable"
+    print 
"---------------------------------------------------------------------"
+    time.sleep(2)
+    extensions = [ ]
 
-objectrow = Extension('kaa._objectrow', ['src/extensions/objectrow.c'])
-if objectrow.check_library("glib-2.0", "2.4.0"):
-    extensions.append(objectrow)
 else:
-    print "glib >= 2.4.0 not found; kaa.db will be unavailable"
+    extensions = [ ext ]
 
-inotify_ext = Extension("kaa.inotify._inotify",
-                        ["src/extensions/inotify/inotify.c"],
-                        config='src/extensions/inotify/config.h')
-
-if not inotify_ext.check_cc(["<sys/inotify.h>"], "inotify_init();"):
-    if not inotify_ext.check_cc(["<sys/syscall.h>"], "syscall(0);"):
-        print "inotify not enabled: doesn't look like a Linux system."
+    objectrow = Extension('kaa._objectrow', ['src/extensions/objectrow.c'])
+    if objectrow.check_library("glib-2.0", "2.4.0"):
+        extensions.append(objectrow)
     else:
-        print "inotify not supported in glibc; no problem, using built-in 
support instead."
-        inotify_ext.config("#define USE_FALLBACK")
-        extensions.append(inotify_ext)
+        print "glib >= 2.4.0 not found; kaa.db will be unavailable"
 
-else:
-    print "inotify supported by glibc; good."
-    extensions.append(inotify_ext)
+    inotify_ext = Extension("kaa.inotify._inotify",
+                            ["src/extensions/inotify/inotify.c"],
+                            config='src/extensions/inotify/config.h')
+
+    if not inotify_ext.check_cc(["<sys/inotify.h>"], "inotify_init();"):
+        if not inotify_ext.check_cc(["<sys/syscall.h>"], "syscall(0);"):
+            print "inotify not enabled: doesn't look like a Linux system."
+        else:
+            print "inotify not supported in glibc; no problem, using built-in 
support instead."
+            inotify_ext.config("#define USE_FALLBACK")
+            extensions.append(inotify_ext)
+
+    else:
+        print "inotify supported by glibc; good."
+        extensions.append(inotify_ext)
 
-if not os.path.exists(os.path.join(distutils.sysconfig.get_python_inc(), 
'Python.h')):
-    print 
"---------------------------------------------------------------------"
-    print "Python headers not found; please install python development 
package."
-    print "kaa.db and inotify support will be unavailable"
-    print 
"---------------------------------------------------------------------"
-    time.sleep(2)
-    extensions = []
-    
 # call setup
 setup(
     module       = 'base',

Modified: trunk/base/src/distribution/core.py
==============================================================================
--- trunk/base/src/distribution/core.py (original)
+++ trunk/base/src/distribution/core.py Sun May 20 20:25:01 2007
@@ -330,6 +330,13 @@
         return compile(includes, code, args)
 
 
+    def has_python_h(self):
+        """
+        Return True if Python.h is found in the system. If not compiling
+        the extention will fail in most cases.
+        """
+        return 
os.path.exists(os.path.join(distutils.sysconfig.get_python_inc(), 'Python.h'))
+        
     def convert(self):
         """
         Convert Extension into a distutils.core.Extension.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to