diff options
author | Jay Freeman <saurik@saurik.com> | 2008-02-14 11:04:20 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2008-02-14 11:04:20 +0000 |
commit | 62882fc0471895bc1a47c13e22daf35dcaafecd0 (patch) | |
tree | c5fb76fc3f64e729fdabeb9c35774e722000fd4e | |
parent | 8e60af7ad00762fb8a89ae39c771287f3c5efed4 (diff) |
Got PyObjC working.
git-svn-id: http://svn.telesphoreo.org/trunk@74 514c082c-b64e-11dc-b46d-3d985efe055d
51 files changed, 520 insertions, 0 deletions
diff --git a/data/darwintools/DarwinTools-1.tar.gz b/data/darwintools/DarwinTools-1.tar.gz Binary files differnew file mode 100644 index 000000000..b5676a5a0 --- /dev/null +++ b/data/darwintools/DarwinTools-1.tar.gz diff --git a/data/darwintools/_metadata/description b/data/darwintools/_metadata/description new file mode 100644 index 000000000..6368d6296 --- /dev/null +++ b/data/darwintools/_metadata/description @@ -0,0 +1 @@ +startupfiletool, sw_vers diff --git a/data/darwintools/_metadata/license b/data/darwintools/_metadata/license new file mode 100644 index 000000000..206bf7e11 --- /dev/null +++ b/data/darwintools/_metadata/license @@ -0,0 +1,38 @@ +startupfiletool.c: + +/* + * startupfiletool - Shantonu Sen <ssen@opendarwin.org> + * Tool to set HFS+ Startup File + * cc -o startupfiletool startupfiletool.c -O0 -g -Wall + */ + +sw_vers.c: + +/* + * Copyright (c) 2005 Finlay Dobbie + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Finlay Dobbie nor the names of his contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ diff --git a/data/darwintools/_metadata/maintainer b/data/darwintools/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/darwintools/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik
\ No newline at end of file diff --git a/data/darwintools/_metadata/priority b/data/darwintools/_metadata/priority new file mode 100644 index 000000000..fad9e164a --- /dev/null +++ b/data/darwintools/_metadata/priority @@ -0,0 +1 @@ +required diff --git a/data/darwintools/_metadata/section b/data/darwintools/_metadata/section new file mode 100644 index 000000000..7fbe952b7 --- /dev/null +++ b/data/darwintools/_metadata/section @@ -0,0 +1 @@ +admin diff --git a/data/darwintools/_metadata/version b/data/darwintools/_metadata/version new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/data/darwintools/_metadata/version @@ -0,0 +1 @@ +1 diff --git a/data/darwintools/make.sh b/data/darwintools/make.sh new file mode 100644 index 000000000..cf0191d94 --- /dev/null +++ b/data/darwintools/make.sh @@ -0,0 +1,8 @@ +pkg:extract +cd * +pkg: mkdir -p /usr/bin + +for tool in startupfiletool sw_vers; do + arm-apple-darwin-gcc -o "${tool}" "${tool}.c" -framework CoreFoundation + pkg: cp -a "${tool}" /usr/bin +done diff --git a/data/iphone-python/HelloPython.app/Default.png b/data/iphone-python/HelloPython.app/Default.png Binary files differnew file mode 100644 index 000000000..f475d4db7 --- /dev/null +++ b/data/iphone-python/HelloPython.app/Default.png diff --git a/data/iphone-python/HelloPython.app/HelloPython b/data/iphone-python/HelloPython.app/HelloPython new file mode 100755 index 000000000..4c0b5eede --- /dev/null +++ b/data/iphone-python/HelloPython.app/HelloPython @@ -0,0 +1,2 @@ +#!/bin/bash +exec "$(dirname "$0")"/Python "$(dirname "$0")"/HelloPython.py diff --git a/data/iphone-python/HelloPython.app/HelloPython.py b/data/iphone-python/HelloPython.app/HelloPython.py new file mode 100644 index 000000000..c78b141e6 --- /dev/null +++ b/data/iphone-python/HelloPython.app/HelloPython.py @@ -0,0 +1,42 @@ +import objc +import _uicaboodle +from objc import YES, NO +objc.loadBundle('UIKit', globals(), '/System/Library/Frameworks/UIKit.framework') +UIApplication = objc.lookUpClass('UIApplication') +UITable = objc.lookUpClass('UITable') +UIWindow = objc.lookUpClass('UIWindow') +UIHardware = objc.lookUpClass('UIHardware') + +class PYApplication(UIApplication): + def applicationDidFinishLaunching_(self, unused): + frame = UIHardware.fullScreenApplicationContentRect() + self.window = UIWindow.alloc().initWithFrame_(frame) + + self.view = UIView.alloc().initWithFrame_(self.window.bounds()) + self.window.setContentView_(self.view) + + self.window.orderFront_(self) + self.window.makeKey_(self) + self.window._setHidden_(NO) + + navsize = UINavigationBar.defaultSize() + navrect = ((0, 0), navsize) + + self.navbar = UINavigationBar.alloc().initWithFrame_(navrect); + self.view.addSubview_(self.navbar) + + self.navbar.setBarStyle_(1) + self.navbar.setDelegate_(self) + + navitem = UINavigationItem.alloc().initWithTitle_('Contacts') + self.navbar.pushNavigationItem_(navitem) + + bounds = self.view.bounds() + tblrect = ((0, navsize[0]), (bounds[1][0] - navsize[0], bounds[1][1])) + + self.table = UITable.alloc().initWithFrame_(tblrect) + self.view.addSubview_(self.table) + + self.table.reloadData() + +_uicaboodle.UIApplicationMain(['HelloPython'], PYApplication) diff --git a/data/iphone-python/HelloPython.app/Info.plist b/data/iphone-python/HelloPython.app/Info.plist new file mode 100644 index 000000000..c1eb44343 --- /dev/null +++ b/data/iphone-python/HelloPython.app/Info.plist @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + + <key>CFBundleExecutable</key> + <string>HelloPython</string> + + <key>CFBundleIdentifier</key> + <string>com.saurik.HelloPython</string> + + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + + <key>CFBundleName</key> + <string>HelloPython</string> + + <key>CFBundlePackageType</key> + <string>APPL</string> + + <key>CFBundleShortVersionString</key> + <string>1.0</string> + + <key>CFBundleSignature</key> + <string>????</string> + + <key>CFBundleVersion</key> + <string>1.0</string> +</dict> + +</plist> diff --git a/data/iphone-python/HelloPython.app/Python b/data/iphone-python/HelloPython.app/Python new file mode 120000 index 000000000..acd4152a9 --- /dev/null +++ b/data/iphone-python/HelloPython.app/Python @@ -0,0 +1 @@ +/usr/bin/python
\ No newline at end of file diff --git a/data/iphone-python/HelloPython.app/icon.png b/data/iphone-python/HelloPython.app/icon.png Binary files differnew file mode 100644 index 000000000..6ab79fbcb --- /dev/null +++ b/data/iphone-python/HelloPython.app/icon.png diff --git a/data/iphone-python/_metadata/description b/data/iphone-python/_metadata/description new file mode 100644 index 000000000..fea726284 --- /dev/null +++ b/data/iphone-python/_metadata/description @@ -0,0 +1 @@ +example applications (with source) in Python diff --git a/data/iphone-python/_metadata/license b/data/iphone-python/_metadata/license new file mode 120000 index 000000000..b9c4e3684 --- /dev/null +++ b/data/iphone-python/_metadata/license @@ -0,0 +1 @@ +../../../licenses/menes
\ No newline at end of file diff --git a/data/iphone-python/_metadata/maintainer b/data/iphone-python/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/iphone-python/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik
\ No newline at end of file diff --git a/data/iphone-python/_metadata/name b/data/iphone-python/_metadata/name new file mode 100644 index 000000000..bfae7cdd3 --- /dev/null +++ b/data/iphone-python/_metadata/name @@ -0,0 +1 @@ +iPhone/Python diff --git a/data/iphone-python/_metadata/priority b/data/iphone-python/_metadata/priority new file mode 100644 index 000000000..134d9bc32 --- /dev/null +++ b/data/iphone-python/_metadata/priority @@ -0,0 +1 @@ +optional diff --git a/data/iphone-python/_metadata/section b/data/iphone-python/_metadata/section new file mode 100644 index 000000000..46c5d2cde --- /dev/null +++ b/data/iphone-python/_metadata/section @@ -0,0 +1 @@ +Python diff --git a/data/iphone-python/_metadata/uicaboodle.py.dep b/data/iphone-python/_metadata/uicaboodle.py.dep new file mode 120000 index 000000000..95b4afa0a --- /dev/null +++ b/data/iphone-python/_metadata/uicaboodle.py.dep @@ -0,0 +1 @@ +../../uicaboodle.py
\ No newline at end of file diff --git a/data/iphone-python/_metadata/version b/data/iphone-python/_metadata/version new file mode 100644 index 000000000..97a6d65a2 --- /dev/null +++ b/data/iphone-python/_metadata/version @@ -0,0 +1 @@ +1.0.2308 diff --git a/data/iphone-python/make.sh b/data/iphone-python/make.sh new file mode 100644 index 000000000..e66e92cc9 --- /dev/null +++ b/data/iphone-python/make.sh @@ -0,0 +1,3 @@ +pkg: mkdir /Applications +pkg: cp -a %/HelloPython.app /Applications +pkg: find / -name '.svn' -prune -exec rm -rfv {} \; diff --git a/data/pyobjc/_metadata/description b/data/pyobjc/_metadata/description new file mode 100644 index 000000000..59b35c863 --- /dev/null +++ b/data/pyobjc/_metadata/description @@ -0,0 +1 @@ +Python/Objective-C connection library diff --git a/data/pyobjc/_metadata/license b/data/pyobjc/_metadata/license new file mode 100644 index 000000000..b550eba6c --- /dev/null +++ b/data/pyobjc/_metadata/license @@ -0,0 +1,9 @@ +(This is the MIT license) + +Copyright 2002, 2003 - Bill Bumgarner, Ronald Oussoren, Steve Majewski, Lele Gaifax, et.al. + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/data/pyobjc/_metadata/maintainer b/data/pyobjc/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/pyobjc/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik
\ No newline at end of file diff --git a/data/pyobjc/_metadata/name b/data/pyobjc/_metadata/name new file mode 100644 index 000000000..64145f73a --- /dev/null +++ b/data/pyobjc/_metadata/name @@ -0,0 +1 @@ +PyObjC diff --git a/data/pyobjc/_metadata/priority b/data/pyobjc/_metadata/priority new file mode 100644 index 000000000..134d9bc32 --- /dev/null +++ b/data/pyobjc/_metadata/priority @@ -0,0 +1 @@ +optional diff --git a/data/pyobjc/_metadata/section b/data/pyobjc/_metadata/section new file mode 100644 index 000000000..46c5d2cde --- /dev/null +++ b/data/pyobjc/_metadata/section @@ -0,0 +1 @@ +Python diff --git a/data/pyobjc/_metadata/version b/data/pyobjc/_metadata/version new file mode 100644 index 000000000..8114c7796 --- /dev/null +++ b/data/pyobjc/_metadata/version @@ -0,0 +1 @@ +1946 diff --git a/data/pyobjc/make.sh b/data/pyobjc/make.sh new file mode 100644 index 000000000..8342d7232 --- /dev/null +++ b/data/pyobjc/make.sh @@ -0,0 +1,18 @@ +pkg:extract +cd * +pkg:patch +cd pyobjc-core + +$(arm-apple-darwin-gcc -print-prog-name=cc1obj) -print-objc-runtime-info <(echo) >Modules/objc/objc-runtime-info.h + +find Modules/objc -name '*.m' -print0 | while read -d $'\0' -r m; do + o=${m%.m}.o + mi=${m%.m}.mi + arm-apple-darwin-gcc -O0 -g3 -I"${PKG_ROOT}"/usr/include/{libxml2,python2.5} -ObjC -c -o "$o" "$m" -DNO_OBJC2_RUNTIME -IModules/objc -fno-common +done + +arm-apple-darwin-gcc -O0 -g3 -dynamiclib -lpython2.5 -o _objc.dylib Modules/objc/*.o -lobjc -lffi -lxml2 -framework CoreFoundation -framework Foundation + +pkg: mkdir -p /usr/lib/python2.5/lib-dynload +pkg: cp -a _objc.dylib /usr/lib/python2.5/lib-dynload +pkg: cp -a Lib/objc /usr/lib/python2.5 diff --git a/data/pyobjc/port.diff b/data/pyobjc/port.diff new file mode 100644 index 000000000..53880d5fe --- /dev/null +++ b/data/pyobjc/port.diff @@ -0,0 +1,234 @@ +Index: pyobjc/pyobjc-core/Modules/objc/closure_pool.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/closure_pool.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/closure_pool.m (working copy) +@@ -5,6 +5,7 @@ + #include "pyobjc.h" + + #include <sys/mman.h> ++#include <mach/vm_param.h> + + typedef struct freelist { + struct freelist* next; +Index: pyobjc/pyobjc-core/Modules/objc/libffi_support.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/libffi_support.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/libffi_support.m (working copy) +@@ -13,6 +13,7 @@ + * FIXME: There's way to much duplicated code in here, please refactor me. + */ + #include "pyobjc.h" ++#include "objc-runtime-info.h" + + #import <Foundation/NSHost.h> + #import <CoreFoundation/CoreFoundation.h> +@@ -22,37 +23,9 @@ + unsigned short*, unsigned short*); + #endif; + +-/* +- * Define SMALL_STRUCT_LIMIT as the largest struct that will be returned +- * in registers instead of with a hidden pointer argument. +- */ +- + static const char gCharEncoding[] = { _C_CHR, 0 }; + static const char gCFRangeEncoding[1024] = { 0 }; + +-#if defined(__ppc__) +- +-# define SMALL_STRUCT_LIMIT 4 +- +-#elif defined(__ppc64__) +- +-# define SMALL_STRUCT_LIMIT 8 +- +-#elif defined(__i386__) +- +-# define SMALL_STRUCT_LIMIT 8 +- +-#elif defined(__x86_64__) +- +-# define SMALL_STRUCT_LIMIT 16 +- +-#else +- +-# error "Unsupported MACOSX platform" +- +-#endif +- +- + #ifndef FFI_CLOSURES + # error "Need FFI_CLOSURES!" + #endif +@@ -3527,24 +3500,8 @@ + ffi64_stret_needs_ptr(signature_to_ffi_return_type(rettype), NULL, NULL) + + #else /* !__ppc64__ */ +- (resultSize > SMALL_STRUCT_LIMIT +-#ifdef __i386__ +- /* darwin/x86 ABI is slightly odd ;-) */ +- || (resultSize != 1 +- && resultSize != 2 +- && resultSize != 4 +- && resultSize != 8) +-#endif +-#ifdef __x86_64__ +- /* darwin/x86-64 ABI is slightly odd ;-) */ +- || (resultSize != 1 +- && resultSize != 2 +- && resultSize != 4 +- && resultSize != 8 +- && resultSize != 16 +- ) +-#endif +- ) ++ (resultSize > OBJC_MAX_STRUCT_BY_VALUE || ++ struct_forward_array[resultSize] != 0) + #endif /* !__ppc64__ */ + ) { + +Index: pyobjc/pyobjc-core/Modules/objc/class-builder.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/class-builder.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/class-builder.m (working copy) +@@ -1860,7 +1860,7 @@ + /* Parent doesn't know the key, try to create in the + * python side, just like for plain python objects. + */ +- if (([[localException name] isEqual:@"NSUnknownKeyException"] ++ if (([[localException name] isEqual:@"NSUndefinedKeyException"] + ) && [[self class] accessInstanceVariablesDirectly]) { + + PyGILState_STATE state = PyGILState_Ensure(); +@@ -1972,7 +1972,7 @@ + /* Parent doesn't know the key, try to create in the + * python side, just like for plain python objects. + */ +- if (([[localException name] isEqual:@"NSUnknownKeyException"] ++ if (([[localException name] isEqual:@"NSUndefinedKeyException"] + ) && [[self class] accessInstanceVariablesDirectly]) { + + PyGILState_STATE state = PyGILState_Ensure(); +Index: pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.h +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.h (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.h (working copy) +@@ -44,7 +44,7 @@ + #define objc_superSetReceiver(super, val) (super).receiver = (val) + #define objc_superGetReceiver(super) ((super).receiver) + +-#ifdef __OBJC2__ ++#ifdef __cplusplus + + #define objc_superSetClass(super, cls) (super).super_class = (cls) + #define objc_superGetClass(super) ((super).super_class) +Index: pyobjc/pyobjc-core/Modules/objc/toll-free-bridging.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/toll-free-bridging.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/toll-free-bridging.m (working copy) +@@ -10,7 +10,7 @@ + + #import <Foundation/NSURL.h> + +-#ifndef __OBJC2__ ++#if 0 + #include "pymactoolbox.h" + #endif + +@@ -26,7 +26,7 @@ + + } + +-#ifndef __OBJC2__ ++#if 0 + int r; + + /* Fall back to MacPython CFType support: */ +@@ -47,7 +47,7 @@ + PyObject* + PyObjC_IDToCFType(id argument) + { +-#ifndef __OBJC2__ ++#if 0 + CFTypeRef typeRef = (CFTypeRef)argument; + CFTypeID typeID = CFGetTypeID(argument); + +Index: pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.m (working copy) +@@ -821,7 +821,7 @@ + */ + PyObjC_class_addMethodList = compat_class_addMethodList; + PyObjC_methodlist_magic = compat_methodlist_magic; +- PyObjC_objc_disposeClassPair = compat_objc_freeClassPair; ++ PyObjC_objc_disposeClassPair = compat_objc_disposeClassPair; + PyObjC_preclass_addMethod = compat_preclass_addMethod; + PyObjC_preclass_addIvar = compat_preclass_addIvar; + PyObjC_preclass_addProtocol = compat_preclass_addProtocol; +Index: pyobjc/pyobjc-core/Modules/objc/test/structargs.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/test/structargs.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/test/structargs.m (working copy) +@@ -3,7 +3,7 @@ + #include "Python.h" + #include "pyobjc-api.h" + +-#import <Cocoa/Cocoa.h> ++#import <Foundation/Foundation.h> + + @interface StructArgClass : NSObject + { +Index: pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m (working copy) +@@ -35,7 +35,7 @@ + #import "OC_PythonUnicode.h" + #import "OC_PythonString.h" + +-extern NSString * const NSUnknownKeyException; /* Radar #3336042 */ ++extern NSString * const NSUndefinedKeyException; /* Radar #3336042 */ + + PyObject *OC_PythonObject_DepythonifyTable = NULL; + PyObject *OC_PythonObject_PythonifyStructTable = NULL; +@@ -938,7 +938,7 @@ + - (void)unableToSetNilForKey: (NSString*) key; + { + [NSException +- raise: NSUnknownKeyException ++ raise: NSUndefinedKeyException + format: @"cannot set Nil for key: %@", key]; + } + +@@ -950,7 +950,7 @@ + - (void)valueForUndefinedKey: (NSString*)key; + { + [NSException +- raise: NSUnknownKeyException ++ raise: NSUndefinedKeyException + format: @"query for unknown key: %@", key]; + } + +@@ -962,7 +962,7 @@ + - (void)setValue: value forUndefinedKey: (NSString*) key; + { + [NSException +- raise: NSUnknownKeyException ++ raise: NSUndefinedKeyException + format: @"setting unknown key: %@ to <%@>", key, value]; + } + +Index: pyobjc/pyobjc-core/Modules/objc/objc_util.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/objc_util.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/objc_util.m (working copy) +@@ -45,7 +45,7 @@ + return PyExc_ValueError; + } else if (strcmp(value, "NSMallocException") == 0) { + return PyExc_MemoryError; +- } else if (strcmp(value, "NSUnknownKeyException") == 0) { ++ } else if (strcmp(value, "NSUndefinedKeyException") == 0) { + return PyExc_KeyError; + } + diff --git a/data/pyobjc/pyobjc-1946.tgz b/data/pyobjc/pyobjc-1946.tgz Binary files differnew file mode 100644 index 000000000..428bd92fd --- /dev/null +++ b/data/pyobjc/pyobjc-1946.tgz diff --git a/data/setuptools/_metadata/description b/data/setuptools/_metadata/description new file mode 100644 index 000000000..ddd90c64a --- /dev/null +++ b/data/setuptools/_metadata/description @@ -0,0 +1 @@ +package manager for Python modules diff --git a/data/setuptools/_metadata/maintainer b/data/setuptools/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/setuptools/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik
\ No newline at end of file diff --git a/data/setuptools/_metadata/priority b/data/setuptools/_metadata/priority new file mode 100644 index 000000000..134d9bc32 --- /dev/null +++ b/data/setuptools/_metadata/priority @@ -0,0 +1 @@ +optional diff --git a/data/setuptools/_metadata/python b/data/setuptools/_metadata/python new file mode 120000 index 000000000..292d106a0 --- /dev/null +++ b/data/setuptools/_metadata/python @@ -0,0 +1 @@ +../../../licenses/python
\ No newline at end of file diff --git a/data/setuptools/_metadata/section b/data/setuptools/_metadata/section new file mode 100644 index 000000000..46c5d2cde --- /dev/null +++ b/data/setuptools/_metadata/section @@ -0,0 +1 @@ +Python diff --git a/data/setuptools/_metadata/version b/data/setuptools/_metadata/version new file mode 100644 index 000000000..231f2192d --- /dev/null +++ b/data/setuptools/_metadata/version @@ -0,0 +1 @@ +0.6c7 diff --git a/data/setuptools/make.sh b/data/setuptools/make.sh new file mode 100644 index 000000000..f621d3428 --- /dev/null +++ b/data/setuptools/make.sh @@ -0,0 +1,3 @@ +tail -n +9 "${PKG_DATA}/setuptools-0.6c7-py2.5.egg" >setuptools.zip +unzip -d setuptools setuptools.zip +cd setuptools diff --git a/data/setuptools/setuptools-0.6c7-py2.5.egg b/data/setuptools/setuptools-0.6c7-py2.5.egg Binary files differnew file mode 100644 index 000000000..f1c81d842 --- /dev/null +++ b/data/setuptools/setuptools-0.6c7-py2.5.egg diff --git a/data/uicaboodle.py/_metadata/description b/data/uicaboodle.py/_metadata/description new file mode 100644 index 000000000..009000489 --- /dev/null +++ b/data/uicaboodle.py/_metadata/description @@ -0,0 +1 @@ +iPhone-specific PyObjC extensions diff --git a/data/uicaboodle.py/_metadata/license b/data/uicaboodle.py/_metadata/license new file mode 120000 index 000000000..b9c4e3684 --- /dev/null +++ b/data/uicaboodle.py/_metadata/license @@ -0,0 +1 @@ +../../../licenses/menes
\ No newline at end of file diff --git a/data/uicaboodle.py/_metadata/maintainer b/data/uicaboodle.py/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/uicaboodle.py/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik
\ No newline at end of file diff --git a/data/uicaboodle.py/_metadata/name b/data/uicaboodle.py/_metadata/name new file mode 100644 index 000000000..15b83dace --- /dev/null +++ b/data/uicaboodle.py/_metadata/name @@ -0,0 +1 @@ +UICaboodle.py diff --git a/data/uicaboodle.py/_metadata/priority b/data/uicaboodle.py/_metadata/priority new file mode 100644 index 000000000..134d9bc32 --- /dev/null +++ b/data/uicaboodle.py/_metadata/priority @@ -0,0 +1 @@ +optional diff --git a/data/uicaboodle.py/_metadata/pyobjc.dep b/data/uicaboodle.py/_metadata/pyobjc.dep new file mode 120000 index 000000000..a208096d6 --- /dev/null +++ b/data/uicaboodle.py/_metadata/pyobjc.dep @@ -0,0 +1 @@ +../../pyobjc
\ No newline at end of file diff --git a/data/uicaboodle.py/_metadata/section b/data/uicaboodle.py/_metadata/section new file mode 100644 index 000000000..46c5d2cde --- /dev/null +++ b/data/uicaboodle.py/_metadata/section @@ -0,0 +1 @@ +Python diff --git a/data/uicaboodle.py/_metadata/version b/data/uicaboodle.py/_metadata/version new file mode 100644 index 000000000..14fde4785 --- /dev/null +++ b/data/uicaboodle.py/_metadata/version @@ -0,0 +1 @@ +1.0.2307 diff --git a/data/uicaboodle.py/make.sh b/data/uicaboodle.py/make.sh new file mode 100644 index 000000000..6fe3a7ede --- /dev/null +++ b/data/uicaboodle.py/make.sh @@ -0,0 +1,3 @@ +arm-apple-darwin-gcc -o _uicaboodle.dylib "${PKG_DATA}/uicaboodle.m" -I"${PKG_ROOT}"/usr/include/python2.5 -I "$(PKG_WORK_ pyobjc)"/*/pyobjc-core/Modules/objc -lpython2.5 -framework UIKit -dynamiclib -framework Foundation +pkg: mkdir -p /usr/lib/python2.5/lib-dynload +pkg: cp -a _uicaboodle.dylib /usr/lib/python2.5/lib-dynload diff --git a/data/uicaboodle.py/uicaboodle.m b/data/uicaboodle.py/uicaboodle.m new file mode 100644 index 000000000..6cd372868 --- /dev/null +++ b/data/uicaboodle.py/uicaboodle.m @@ -0,0 +1,92 @@ +#include <Python.h> +#include "pyobjc-api.h" +#import <UIKit/UIKit.h> + +#define _trace() \ + fprintf(stderr, "_trace():%s(%d):%s\n", __FILE__, __LINE__, __FUNCTION__) + +#define _assert(test) \ + do if (!(test)) { \ + fprintf(stderr, "_assert(%s):%s(%d):%s\n", #test, __FILE__, __LINE__, __FUNCTION__); \ + exit(-1); \ + } while (false) + +static PyObject* objc_UIApplicationMain( + PyObject *self __attribute__((__unused__)), + PyObject *args +) { + int argc; + char **argv; + size_t i; + int res = -1; + + PyObject *arga; + PyObject *_class; + + _assert(PyObjC_API != NULL); + _assert(args != NULL); + + if (!PyArg_ParseTuple(args, "OO", &arga, &_class)) { + PyErr_SetString(PyExc_TypeError, "Invalid Arguments"); + return NULL; + } + + _assert(arga != NULL); + _assert(_class != NULL); + + argc = PySequence_Size(arga); + argv = calloc(argc + 1, sizeof(char *)); + + if (argv == NULL) { + PyErr_SetString(PyExc_MemoryError, "Out of memory"); + return NULL; + } + + for (i = 0; i != argc; ++i) { + PyObject *arg = PySequence_GetItem(arga, i); + if (arg == NULL) { + PyErr_SetString(PyExc_TypeError, "UIApplicationMain: null argument"); + goto error; + } + + if (!PyString_Check(arg)) { + PyErr_SetString(PyExc_TypeError, "UIApplicationMain: non-string argument"); + goto error; + } + + argv[i] = strdup(PyString_AsString(arg)); + if (argv[i] == NULL) { + PyErr_SetString(PyExc_MemoryError, "Out of memory"); + goto error; + } + } + + PyObjC_DURING + res = UIApplicationMain(argc, argv, PyObjC_API->cls_get_class(_class)); + PyObjC_HANDLER + PyObjCErr_FromObjC(localException); + PyObjC_ENDHANDLER + + error: + for (i = 0; i != argc; ++i) + free(argv[i]); + free(argv); + + if (res == -1 && PyErr_Occurred()) + return NULL; + return PyInt_FromLong(res); +} + +static PyMethodDef mod_methods[] = {{ + "UIApplicationMain", + /*(PyCFunction)*/ objc_UIApplicationMain, + METH_VARARGS|METH_KEYWORDS, + "int UIApplicationMain(int argc, const char *argv[], Class _class);" +}, { + NULL, NULL, 0, NULL +}}; + +void init_uicaboodle(void) { + PyObject *module = Py_InitModule4("_uicaboodle", mod_methods, "", NULL, PYTHON_API_VERSION); + PyObjC_ImportAPI(module); +} |