Commits

Ronald Oussoren  committed 86eec33

Ensure that all manual wrappers are available when building on 10.8

(Before this patch a number of APIs that were dropped in 10.8 weren't
available through PyObjC when building on 10.8, even when running the
binaries on 10.7 or earlier.

Also fixes a test failure caused by a semantic change in core.

  • Participants
  • Parent commits 1cd4e03

Comments (0)

Files changed (3)

File pyobjc-framework-Quartz/Modules/_callbacks.m

 #import <CoreGraphics/CoreGraphics.h>
 #endif
 
+#if PyObjC_BUILD_RELEASE >= 1008
+
+typedef size_t (*CGDataProviderGetBytesCallback) (void *info, void *buffer, size_t count);
+typedef void (*CGDataProviderSkipBytesCallback) (void *info, size_t count);
+typedef void (*CGDataProviderRewindCallback) (void *info);
+typedef void (*CGDataProviderReleaseInfoCallback) (void *info);
+typedef const void * (*CGDataProviderGetBytePointerCallback) (void *info);
+typedef void (*CGDataProviderReleaseBytePointerCallback) (void *info, const void *pointer);
+typedef size_t (*CGDataProviderGetBytesAtOffsetCallback) (void *info, void *buffer, size_t offset, size_t count);
+
+typedef struct CGDataProviderCallbacks {
+	CGDataProviderGetBytesCallback getBytes;
+	CGDataProviderSkipBytesCallback skipBytes;
+	CGDataProviderRewindCallback rewind;
+	CGDataProviderReleaseInfoCallback releaseProvider;
+} CGDataProviderCallbacks;
+
+typedef struct CGDataProviderDirectAccessCallbacks {
+	CGDataProviderGetBytePointerCallback getBytePointer;
+	CGDataProviderReleaseBytePointerCallback releaseBytePointer;
+	CGDataProviderGetBytesAtOffsetCallback getBytes;
+	CGDataProviderReleaseInfoCallback releaseProvider;
+} CGDataProviderDirectAccessCallbacks;
+
+extern CGDataProviderRef CGDataProviderCreate (void *info, const CGDataProviderCallbacks *callbacks);
+extern CGDataProviderRef CGDataProviderCreateDirectAccess (void *info, size_t size, const CGDataProviderDirectAccessCallbacks *callbacks);
+
+#endif
+
 
 /* 
  *
 	return c_result;
 }
 
-#if PyObjC_BUILD_RELEASE < 1008
-/* XXX: compile this in on 10.8 as well */
-
 static void 
 m_CGDataProviderSkipBytesCallback(void* _info, size_t count)
 {
 	PyGILState_Release(state);
 }
 
-#endif
 
 static void 
 m_CGDataProviderRewindCallback(void* _info)
 	PyGILState_Release(state);
 }
 
-#if PyObjC_BUILD_RELEASE < 1008
-/* XXX: compile this in on 10.8 as well */
+
+
 static CGDataProviderCallbacks m_CGDataProviderCallbacks = {
 	m_CGDataProviderGetBytesCallback, 	/*  getBytes */
 	m_CGDataProviderSkipBytesCallback,	/*  skipBytes */
 	m_CGDataProviderRewindCallback,		/*  rewind */
 	m_CGDataProviderReleaseInfoCallback	/*  releaseProvider */
 };
-#endif /* PyObjC_BUILD_RELEASE < 1008 */
 
-#if PyObjC_BUILD_RELEASE < 1008
-/* XXX: compile this in on 10.8 as well, using manual weaklinking support */
 static const void*
 m_CGDataProviderGetBytePointerCallback(void* _info)
 {
 	return c_result;
 }
 
+
 static CGDataProviderDirectAccessCallbacks m_CGDataProviderDirectAccessCallbacks = {
 	m_CGDataProviderGetBytePointerCallback,		/* getBytePointer */
 	m_CGDataProviderReleaseBytePointerCallback,	/* releaseBytePointer */
 	m_CGDataProviderGetBytesAtOffsetCallback,	/* getBytes */
 	m_CGDataProviderReleaseInfoCallback		/* releaseProvider */
 };
-#endif /* PyObjC_BUILD_RELEASE < 1008 */
 
 
 
 #endif
 
 
-#if PyObjC_BUILD_RELEASE < 1008
-/* XXX: compile in on 10.8 as well, unless min deploymet > 10.8 */
+WEAK_LINKED_NAME(CGDataProviderCreate)
+
 PyDoc_STRVAR(doc_CGDataProviderCreate,
 	"CGDataConsumerCreate(info, (getBytes, skipBytes, rewind, releaseProvider)) -> object\n"
 	"\n"
 
 	CGDataProviderRef result;
 	PyObjC_DURING
-		result = CGDataProviderCreate(real_info, 
+		result = USE(CGDataProviderCreate)(real_info, 
 				&m_CGDataProviderCallbacks);
 
 	PyObjC_HANDLER
 	return retval;
 }
 
+WEAK_LINKED_NAME(CGDataProviderCreateDirectAccess)
+
 PyDoc_STRVAR(doc_CGDataProviderCreateDirectAccess,
 	"CGDataConsumerCreateDirectAccess(info, (getBytePointer, releaseBytePointer, getBytes, release)) -> object\n"
 	"\n"
 
 	CGDataProviderRef result;
 	PyObjC_DURING
-		result = CGDataProviderCreateDirectAccess(real_info, 
+		result = USE(CGDataProviderCreateDirectAccess)(real_info, 
 				size,
 				&callbacks);
 
 	CGDataProviderRelease(result);
 	return retval;
 }
-#endif
 
 /*
  * CGDataProviderCreateWithData
 		doc_CGDataConsumerCreate
 	},
 
-#if PyObjC_BUILD_RELEASE < 1008
 	{
 		"CGDataProviderCreate",
 		(PyCFunction)m_CGDataProviderCreate,
 		METH_VARARGS,
 		doc_CGDataProviderCreateDirectAccess
 	},
-#endif
 
 #if PyObjC_BUILD_RELEASE >= 1005
 
 #if PyObjC_BUILD_RELEASE >= 1005
 	CHECK_WEAK_LINK_10_5(m, CGDataProviderCreateSequential);
 #endif
+
+	CHECK_WEAK_LINK(m, CGDataProviderCreate);
+	CHECK_WEAK_LINK(m, CGDataProviderCreateDirectAccess);
 	
 	PyObjC_INITDONE();
 }

File pyobjc-framework-Quartz/PyObjCTest/test_ciimageprovider.py

     unicode = str
 
 class TestCIImageProviderHelper (NSObject):
+
+    @objc.namedSelector(b'provideImageData:bytesPerRow:origin::size::userInfo:')
     def provideImageData_bytesPerRow_origin__size__userInfo_(self,
             data, rowbytes, x, y, width, height, userInfo):
         pass

File pyobjc-framework-Quartz/setup.py

         Extension('Quartz.CoreGraphics._inlines',
             [ 'Modules/_CoreGraphics_inlines.m' ]),
         Extension('Quartz.CoreGraphics._callbacks',
-            [ 'Modules/_callbacks.m' ]),
+            [ 'Modules/_callbacks.m' ], extra_compile_args=['-Wno-deprecated-declarations']),
         Extension('Quartz.CoreGraphics._doubleindirect',
             [ 'Modules/_doubleindirect.m' ]),
         Extension('Quartz.CoreGraphics._sortandmap',