[PyObjC-svn] r2045 - in trunk/pyobjc/pyobjc-framework-SearchKit: Doc Lib Lib/SearchKit PyObjCTest

[email protected]
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Sun Jan 25 14:54:10 2009
New Revision: 2045

Log:
* Full API test coverage on Leopard
* API documents a number of GetTypeID functions that aren't actually
  exported. Implement workaround for some of them (others to be added later)


Added:
   trunk/pyobjc/pyobjc-framework-SearchKit/Doc/
   trunk/pyobjc/pyobjc-framework-SearchKit/Doc/api-notes-SearchKit.txt
   trunk/pyobjc/pyobjc-framework-SearchKit/PyObjCTest/test_skanalysis.py   (contents, props changed)
   trunk/pyobjc/pyobjc-framework-SearchKit/PyObjCTest/test_skdocument.py   (contents, props changed)
   trunk/pyobjc/pyobjc-framework-SearchKit/PyObjCTest/test_skindex.py   (contents, props changed)
   trunk/pyobjc/pyobjc-framework-SearchKit/PyObjCTest/test_sksearch.py   (contents, props changed)
   trunk/pyobjc/pyobjc-framework-SearchKit/PyObjCTest/test_sksummary.py   (contents, props changed)
Modified:
   trunk/pyobjc/pyobjc-framework-SearchKit/Lib/   (props changed)
   trunk/pyobjc/pyobjc-framework-SearchKit/Lib/SearchKit/PyObjC.bridgesupport
   trunk/pyobjc/pyobjc-framework-SearchKit/Lib/SearchKit/__init__.py

Modified: trunk/pyobjc/pyobjc-framework-SearchKit/Lib/SearchKit/PyObjC.bridgesupport
==============================================================================
--- trunk/pyobjc/pyobjc-framework-SearchKit/Lib/SearchKit/PyObjC.bridgesupport	(original)
+++ trunk/pyobjc/pyobjc-framework-SearchKit/Lib/SearchKit/PyObjC.bridgesupport	Sun Jan 25 14:54:10 2009
@@ -39,13 +39,13 @@
     <arg type='@' type64='@' />
   </function>
   <function name='SKDocumentCreate'>
-    <retval already_cfretained='true' type='@' type64='@' />
+	  <retval already_cfretained='true' type='@' type64='@' />
     <arg type='^{__CFString=}' />
     <arg type='@' type64='@' />
     <arg type='^{__CFString=}' />
   </function>
   <function name='SKDocumentCreateWithURL'>
-    <retval already_cfretained='true' type='@' type64='@' />
+	  <retval already_cfretained='true' type='@' type64='@' />
     <arg type='^{__CFURL=}' />
   </function>
   <function name='SKDocumentGetName'>

Modified: trunk/pyobjc/pyobjc-framework-SearchKit/Lib/SearchKit/__init__.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-SearchKit/Lib/SearchKit/__init__.py	(original)
+++ trunk/pyobjc/pyobjc-framework-SearchKit/Lib/SearchKit/__init__.py	Sun Jan 25 14:54:10 2009
@@ -13,3 +13,45 @@
     frameworkPath=_objc.pathForFramework(
         "/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework"),
     globals=globals())
+
+try:
+    SKIndexGetTypeID
+
+except NameError:
+    # SKIndexGetTypeID is documented, but not actually exported by Leopard. Try to
+    # emulate the missing functionality. 
+    #
+    # See also radar:6525606.
+    #
+    def workaround():
+        from Foundation import NSMutableData, NSAutoreleasePool
+
+        pool = NSAutoreleasePool.alloc().init()
+        try:
+            r = SKIndexCreateWithMutableData(NSMutableData.data(),
+                    None, kSKIndexInverted, None)
+
+            indexID = CFGetTypeID(r)
+
+            r = SKIndexDocumentIteratorCreate(r, None)
+            iterID = CFGetTypeID(r)
+
+
+        finally:
+            del pool
+
+        def SKIndexGetTypeID():
+            return indexID
+
+        def SKIndexDocumentIteratorGetTypeID():
+            return iterID
+
+        indexType = objc.registerCFSignature(
+                "SKIndexRef", "^{__SKIndex=}", indexID)
+        iterType = objc.registerCFSignature(
+                "SKIndexDocumentIteratorRef", "^{__SKIndexDocumentIterator=}", indexID)
+
+        return (SKIndexGetTypeID, indexType, SKIndexDocumentIteratorGetTypeID, iterType)
+
+    (SKIndexGetTypeID, SKIndexRef, 
+            SKIndexDocumentIteratorGetTypeID, SKIndexDocumentRef) = workaround()

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.