[PyObjC-svn] r2217 - in trunk/pyobjc/pyobjc-framework-Quartz: . Modules

[email protected] Thu, 14 May 2009 03:35:05 -0500
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Thu May 14 03:35:04 2009
New Revision: 2217

Log:
Enable compilation on OSX 10.4. Not tested beyond that.


Modified:
   trunk/pyobjc/pyobjc-framework-Quartz/Modules/_coregraphics.m
   trunk/pyobjc/pyobjc-framework-Quartz/Modules/pyobjc-api.h
   trunk/pyobjc/pyobjc-framework-Quartz/setup.py

Modified: trunk/pyobjc/pyobjc-framework-Quartz/Modules/_coregraphics.m
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Quartz/Modules/_coregraphics.m	(original)
+++ trunk/pyobjc/pyobjc-framework-Quartz/Modules/_coregraphics.m	Thu May 14 03:35:04 2009
@@ -6,6 +6,7 @@
 
 #import <ApplicationServices/ApplicationServices.h>
 
+#ifndef OS_TIGER
 static PyObject*
 m_CGFontCopyTableTags(PyObject* self __attribute__((__unused__)), 
 		PyObject* args)
@@ -123,6 +124,7 @@
 }
 
 
+
 static CFArrayRef
 createWindowList(PyObject* items)
 {
@@ -248,6 +250,7 @@
 	CFRelease(image);
 	return rv;
 }
+#endif /* !OS_TIGER */
 
 static PyObject*
 m_CGBitmapContextCreate(PyObject* self __attribute__((__unused__)), 
@@ -333,6 +336,7 @@
 
 
 static PyMethodDef m_methods[] = {
+#ifndef OS_TIGER
 	{
 		"CGFontCopyTableTags",
 		(PyCFunction)m_CGFontCopyTableTags,
@@ -357,6 +361,7 @@
 		METH_VARARGS,
 		NULL
 	},
+#endif /* !OS_TIGER */
 	{
 		"CGBitmapContextCreate",
 		(PyCFunction)m_CGBitmapContextCreate,

Modified: trunk/pyobjc/pyobjc-framework-Quartz/Modules/pyobjc-api.h
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Quartz/Modules/pyobjc-api.h	(original)
+++ trunk/pyobjc/pyobjc-framework-Quartz/Modules/pyobjc-api.h	Thu May 14 03:35:04 2009
@@ -19,6 +19,41 @@
 #include "Python.h"
 #include <objc/objc.h>
 
+#import <Foundation/NSObjCRuntime.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(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-Quartz/setup.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Quartz/setup.py	(original)
+++ trunk/pyobjc/pyobjc-framework-Quartz/setup.py	Thu May 14 03:35:04 2009
@@ -1,6 +1,24 @@
 ''' 
-Wrappers for frameworks 'CoreGraphics', 'ImageIO', 'QuartzCore', 
-'QuartzFilters', 'ImageKit', 'PDFKit' and 'CoreVideo'.
+Wrappers for the "Quartz" related frameworks on MacOSX. These frameworks
+provide a number of graphics related API's.
+
+The frameworks wrapped by this package are:
+
+   * CoreGraphics - 2D Graphics, based on the PDF model
+
+   * ImageIO - Reading and writing images
+
+   * QuartzComposer - Working with "Quartz Composer" compositions
+
+   * QuartzCore  - Image processing and video image manipulation
+
+   * QuarzFilters - Image effects
+
+   * ImageKit - iPhoto-like views
+
+   * PDFKit - Working with PDF files
+
+   * CoreVideo - Managing digital video
 
 All frameworks can be accessed by importing the 'Quartz' module.
 
@@ -32,6 +50,10 @@
 else:
     CV_CFLAGS=[]
 
+if int(os.uname()[2].split('.')[0]) > 8:
+    CFLAGS = []
+else:
+    CFLAGS=[ "-DNO_OBJC2_RUNTIME", "-DOS_TIGER" ]
 
 setup(
     name='pyobjc-framework-Quartz',
@@ -44,39 +66,38 @@
     platforms = [ "MacOS X" ],
     packages = [ "Quartz", "Quartz.CoreGraphics", "Quartz.ImageIO", "Quartz.QuartzCore", "Quartz.CoreVideo", "Quartz.QuartzComposer", "Quartz.ImageKit", "Quartz.PDFKit", "Quartz.QuartzFilters" ],
     package_dir = { '': 'Lib' },
-    setup_requires = [ 
-    ],
     install_requires = [ 
-        'pyobjc-core>=2.2b1',
-        'pyobjc-framework-Cocoa>=2.2b1',
+        'pyobjc-core>=2.2b2',
+        'pyobjc-framework-Cocoa>=2.2b2',
     ],
-    dependency_links = [],
     package_data = { 
         '': ['*.bridgesupport'] 
     },
     test_suite='PyObjCTest',
     cmdclass = extra_cmdclass,
     options = extra_options('Quartz'),
-
-    # The package is actually zip-safe, but py2app isn't fully zip-aware yet.
-    zip_safe = False,
-
+    zip_safe = True,
     ext_modules = [
         # CoreVideo
         Extension('Quartz.CoreVideo._CVPixelBuffer',
             [ 'Modules/_CVPixelBuffer.m' ],
-            extra_compile_args=CV_CFLAGS),
+            extra_compile_args=CV_CFLAGS + CFLAGS),
 
         # CoreGraphics
         Extension('Quartz.CoreGraphics._inlines',
-            [ 'Modules/_CoreGraphics_inlines.m' ]),
+            [ 'Modules/_CoreGraphics_inlines.m' ],
+            extra_compile_args=CFLAGS),
         Extension('Quartz.CoreGraphics._callbacks',
-            [ 'Modules/_callbacks.m' ]),
+            [ 'Modules/_callbacks.m' ],
+            extra_compile_args=CFLAGS),
         Extension('Quartz.CoreGraphics._doubleindirect',
-            [ 'Modules/_doubleindirect.m' ]),
+            [ 'Modules/_doubleindirect.m' ],
+            extra_compile_args=CFLAGS),
         Extension('Quartz.CoreGraphics._sortandmap',
-            [ 'Modules/_sortandmap.m' ]),
+            [ 'Modules/_sortandmap.m' ],
+            extra_compile_args=CFLAGS),
         Extension('Quartz.CoreGraphics._coregraphics',
-            [ 'Modules/_coregraphics.m' ]),
+            [ 'Modules/_coregraphics.m' ],
+            extra_compile_args=CFLAGS),
     ],
 )

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com