[PyObjC-svn] r2276 - in trunk/pyobjc/pyobjc-framework-FSEvents: Modules PyObjCTest

[email protected] Tue, 01 Sep 2009 13:52:53 -0500
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Tue Sep  1 13:52:53 2009
New Revision: 2276

Log:
Port to SnowLeopard

Modified:
   trunk/pyobjc/pyobjc-framework-FSEvents/Modules/pyobjc-api.h
   trunk/pyobjc/pyobjc-framework-FSEvents/PyObjCTest/test_fsevents.py

Modified: trunk/pyobjc/pyobjc-framework-FSEvents/Modules/pyobjc-api.h
==============================================================================
--- trunk/pyobjc/pyobjc-framework-FSEvents/Modules/pyobjc-api.h	(original)
+++ trunk/pyobjc/pyobjc-framework-FSEvents/Modules/pyobjc-api.h	Tue Sep  1 13:52:53 2009
@@ -19,6 +19,41 @@
 #include "Python.h"
 #include <objc/objc.h>
 
+#import <Foundation/Foundation.h>
+
+#ifndef CGFLOAT_DEFINED
+
+#ifdef __LP64__
+# error "Huh? 64-bit but no CFFloat available???"
+#endif
+
+typedef float CGFloat;
+#define CGFLOAT_MIN FLT_MIN
+#define CGFLOAT_MAX FLT_MAX
+#define CGFLOAT_IS_DOUBLE 0
+#define CGFLOAT_DEFINED
+
+#endif /* CGFLOAT_DEFINED */
+
+
+#ifndef NSINTEGER_DEFINED
+
+#ifdef __LP64__
+# error "Huh? 64-bit but no NSINTEGER available???"
+#endif
+
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+
+#define NSIntegerMax    LONG_MAX
+#define NSIntegerMin    LONG_MIN
+#define NSUIntegerMax   ULONG_MAX
+
+#define NSINTEGER_DEFINED
+
+#endif
+
+
 #ifndef PyObjC_COMPAT_H
 #if (PY_VERSION_HEX < 0x02050000)
 typedef int Py_ssize_t;
@@ -32,7 +67,6 @@
 #endif
 #endif
 
-
 #import <Foundation/NSException.h>
 
 struct PyObjC_WeakLink {
@@ -42,6 +76,7 @@
 
 
 /* threading support */
+#ifdef NO_OBJC2_RUNTIME
 #define PyObjC_DURING \
 		Py_BEGIN_ALLOW_THREADS \
 		NS_DURING
@@ -51,6 +86,20 @@
 #define PyObjC_ENDHANDLER \
 		NS_ENDHANDLER \
 		Py_END_ALLOW_THREADS
+#else
+
+#define	PyObjC_DURING \
+		Py_BEGIN_ALLOW_THREADS \
+		@try {
+
+#define PyObjC_HANDLER } @catch(volatile NSObject* _localException) { \
+		NSException* localException __attribute__((__unused__))= (NSException*)_localException;
+
+#define PyObjC_ENDHANDLER \
+		} \
+		Py_END_ALLOW_THREADS
+
+#endif
 
 #define PyObjC_BEGIN_WITH_GIL \
 	{ \

Modified: trunk/pyobjc/pyobjc-framework-FSEvents/PyObjCTest/test_fsevents.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-FSEvents/PyObjCTest/test_fsevents.py	(original)
+++ trunk/pyobjc/pyobjc-framework-FSEvents/PyObjCTest/test_fsevents.py	Tue Sep  1 13:52:53 2009
@@ -47,7 +47,7 @@
 
         ref = FSEventStreamCreateRelativeToDevice(
                 None, fsevents_callback, context,
-                os.stat('/').st_dev, ["/etc", "/tmp"], kFSEventStreamEventIdSinceNow, 2.0,  kFSEventStreamCreateFlagUseCFTypes|kFSEventStreamCreateFlagNoDefer)
+                os.stat('/').st_dev, [os.path.realpath("/etc"), os.path.realpath("/tmp")], kFSEventStreamEventIdSinceNow, 2.0,  kFSEventStreamCreateFlagUseCFTypes|kFSEventStreamCreateFlagNoDefer)
         self.failUnlessIsInstance(ref, FSEventStreamRef)
         try:
             v = FSEventStreamGetLatestEventId(ref)
@@ -60,7 +60,7 @@
             v = FSEventStreamCopyPathsBeingWatched(ref)
             self.failUnlessIsInstance(v, CFArrayRef)
             self.failUnlessEqual(len(v), 2)
-            self.failUnlessEqual(v, ["/etc", "/tmp"])
+            self.failUnlessEqual(v, [os.path.realpath("/etc")[1:], os.path.realpath("/tmp")[1:]])
 
             v = FSEventsGetCurrentEventId()
             self.failUnlessIsInstance(v, (int, long))

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july