Commits

Ronald Oussoren  committed 429f9e1 Merge

merge

  • Participants
  • Parent commits 848782e, 59ad033

Comments (0)

Files changed (4)

File pyobjc-core/NEWS.txt

   This is the reverse of the *__c_void_p__()* method that was added
   earlier.
 
+- Issue #46: It was not possible to use the Quartz.CoreGraphics module
+  on OSX 10.5 when the binary was build on 10.8 (and using a 10.5 deployment
+  target).
+
+  Simular issues may be present in some of the other framework wrappers,
+  there will be a more generic fix for this issue in a future release.
+
 Version 2.5
 -----------
 

File pyobjc-framework-Cocoa/Modules/_AppKit.m

 PyObjC_MODULE_INIT(_AppKit)
 {
 	PyObject* m;
-	Protocol* p;
 	m = PyObjC_MODULE_CREATE(_AppKit)
 	if (!m) { 
 		PyObjC_INITERROR();
 	if (setup_nsview(m) == -1) PyObjC_INITERROR();
 	if (setup_nswindows(m) == -1) PyObjC_INITERROR();
 
-	p = @protocol(NSSpeechSynthesizerDelegate);
-	if (p != nil) {
-		PyObject* r = PyObjC_ObjCToPython("@", p);
-		Py_XDECREF(r);
-		if (r == NULL) {
-			PyObjC_INITERROR();
-		}
-	}
-
 	PyObjC_INITDONE();
 }

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

 #include <Python.h>
 #include "pyobjc-api.h"
 
+
 #import <ApplicationServices/ApplicationServices.h>
 
+#if PyObjC_BUILD_RELEASE >= 1006
+#  if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
+
+/* 
+ * Implementation of poor-mans weak linking for a 10.6+ symbol, needed
+ * to be able to use a binary created on OSX 10.8 on a 10.5 system.
+ *
+ * XXX: The same mechanism should be used for the other functions wrapped
+ *      in this file.
+ */
+#include <dlfcn.h>
+static CGContextRef (*ptr_CGBitmapContextCreateWithData)(
+		   void *data, size_t width, size_t height, size_t bitsPerComponent, size_t bytesPerRow,
+		  CGColorSpaceRef space, CGBitmapInfo bitmapInfo, CGBitmapContextReleaseDataCallback releaseCallback,
+		   void *releaseInfo);
+#  else
+#    define ptr_CGBitmapContextCreateWithData CGBitmapContextCreateWithData
+#  endif
+#endif
+ 
+
+
 #if PyObjC_BUILD_RELEASE >= 1005
 static PyObject*
 m_CGFontCopyTableTags(PyObject* self __attribute__((__unused__)), 
 
 	CGContextRef ctx = NULL;
 	PyObjC_DURING
-		ctx = CGBitmapContextCreateWithData(data, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo, m_releasecallback, releaseInfo);
+		ctx = ptr_CGBitmapContextCreateWithData(data, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo, m_releasecallback, releaseInfo);
 
 	PyObjC_HANDLER
 		ctx = NULL;
 	}
 #endif 
 
+
+#if (PyObjC_BUILD_RELEASE >= 1006) && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
+	{
+		void* dl = dlopen(NULL, RTLD_GLOBAL);
+		ptr_CGBitmapContextCreateWithData = dlsym(dl, "CGBitmapContextCreateWithData");
+		if (ptr_CGBitmapContextCreateWithData == NULL) {
+			if (PyDict_DelItemString(d, "CGBitmapContextCreateWithData") < 0) {
+				PyObjC_INITERROR();
+			}
+		}
+		/* Don't call dlclose */
+	}
+#endif
+
 	PyObjC_INITDONE();
 }

File pyobjc-framework-Quartz/setup.py

         Extension('Quartz.CoreGraphics._sortandmap',
             [ 'Modules/_sortandmap.m' ]),
         Extension('Quartz.CoreGraphics._coregraphics',
-            [ 'Modules/_coregraphics.m' ]),
+            [ 'Modules/_coregraphics.m' ], extra_link_args=["-framework", "ApplicationServices"]),
     ],
 )