[PyObjC-svn] r2394 - in trunk/pyobjc/pyobjc-core: . Lib/objc Modules/objc
[email protected] Tue, 02 Feb 2010 07:00:46 -0600
| Newsgroups | gmane.comp.python.pyobjc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ronaldoussoren
Date: Tue Feb 2 07:00:46 2010
New Revision: 2394
Log:
* descriptors: actually export the new namedSelector
* pyobjc-api.h: re-add PyObjCObject_Convert, remove pyobjc-compat.h definitions
* export pyobjc-api.h and pyobjc-compat.h in the pyobjc egg-file, to make
it easier to use the right headers in the framework wrappers.
(This does require updates to the setup files of those wrappers)
Modified:
trunk/pyobjc/pyobjc-core/Lib/objc/_descriptors.py
trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.h
trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.m
trunk/pyobjc/pyobjc-core/NEWS.txt
trunk/pyobjc/pyobjc-core/setup.py
Modified: trunk/pyobjc/pyobjc-core/Lib/objc/_descriptors.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/Lib/objc/_descriptors.py (original)
+++ trunk/pyobjc/pyobjc-core/Lib/objc/_descriptors.py Tue Feb 2 07:00:46 2010
@@ -4,7 +4,7 @@
This module defines the core interfaces of the Python<->Objective-C bridge.
"""
-__all__ = ['IBOutlet', 'IBAction', 'accessor', 'Accessor', 'typedAccessor', 'callbackFor', 'selectorFor', 'synthesize', 'namedselector', 'typedSelector' ]
+__all__ = ['IBOutlet', 'IBAction', 'accessor', 'Accessor', 'typedAccessor', 'callbackFor', 'selectorFor', 'synthesize', 'namedselector', 'typedSelector', 'namedSelector' ]
from objc._objc import ivar, selector, _makeClosure, selector, _C_SEL, _C_ID
import sys, textwrap
@@ -110,7 +110,7 @@
def namedselector(name, signature=None):
import warnings
- warnings.warn("use objc.namedSelector instead of objc.namedselector")
+ warnings.warn("use objc.namedSelector instead of objc.namedselector", stacklevel=2)
return namedSelector(name, signature)
def typedAccessor(typeSignature):
Modified: trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.h
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.h (original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.h Tue Feb 2 07:00:46 2010
@@ -21,6 +21,8 @@
#import <Foundation/Foundation.h>
+#include "pyobjc-compat.h"
+
#ifndef CGFLOAT_DEFINED
#ifdef __LP64__
@@ -54,19 +56,6 @@
#endif
-#ifndef PyObjC_COMPAT_H
-#if (PY_VERSION_HEX < 0x02050000)
-typedef int Py_ssize_t;
-#define PY_FORMAT_SIZE_T ""
-#define Py_ARG_SIZE_T "i"
-#define PY_SSIZE_T_MAX INT_MAX
-
-#else
-
-#define Py_ARG_SIZE_T "n"
-#endif
-#endif
-
#import <Foundation/NSException.h>
struct PyObjC_WeakLink {
@@ -347,6 +336,7 @@
int (*is_ascii_string)(PyObject* unicode_string, const char* ascii_string);
int (*is_ascii_prefix)(PyObject* unicode_string, const char* ascii_string, size_t n);
+ int (*pyobjcobject_convert)(PyObject*,void*);
};
#ifndef PYOBJC_BUILD
@@ -406,6 +396,8 @@
#define PyObjC_NULL (*(PyObjC_API->pyobjc_null))
#define PyObjC_DepythonifyCArray (PyObjC_API->dep_c_array_count)
#define PyObjC_VarList_New (PyObjC_API->varlistnew)
+#define PyObjCObject_Convert (PyObjC_API->pyobjcobject_convert)
+
#ifndef PYOBJC_METHOD_STUB_IMPL
Modified: trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.m (original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.m Tue Feb 2 07:00:46 2010
@@ -14,6 +14,7 @@
#undef PyObjCObject_GetObject
#endif
+
static void do_weaklink(PyObject* module_dict, struct PyObjC_WeakLink* funcs)
{
while (funcs->name) {
@@ -146,7 +147,7 @@
PyObjC_VarList_New, /* PyObjC_VarList_New */
PyObjC_is_ascii_string,
PyObjC_is_ascii_prefix,
-
+ PyObjCObject_Convert,
};
int PyObjCAPI_Register(PyObject* module)
Modified: trunk/pyobjc/pyobjc-core/NEWS.txt
==============================================================================
--- trunk/pyobjc/pyobjc-core/NEWS.txt (original)
+++ trunk/pyobjc/pyobjc-core/NEWS.txt Tue Feb 2 07:00:46 2010
@@ -7,6 +7,12 @@
Version 2.3a0
-------------
+- The PyObjC egg now includes the header files that should be used to
+ compile to compile the extensions in the framework wrappers, which makes
+ it a lot easier to access those headers.
+
+- BUGFIX: The definition for Py_ARG_SIZE_T was incorrect, which causes
+ problems in 64-bit code.
- Initial port to Python 3.x
Modified: trunk/pyobjc/pyobjc-core/setup.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/setup.py (original)
+++ trunk/pyobjc/pyobjc-core/setup.py Tue Feb 2 07:00:46 2010
@@ -44,6 +44,30 @@
unittest.main(None, None, [unittest.__file__]+self.test_args)
+from setuptools.command import egg_info as orig_egg_info
+
+def write_header(cmd, basename, filename):
+ data = open(os.path.join('Modules/objc/', os.path.basename(basename)), 'rU').read()
+ if not cmd.dry_run:
+ if not os.path.exists(os.path.dirname(filename)):
+ os.makedirs(os.path.dirname(filename))
+
+ cmd.write_file(basename, filename, data)
+
+
+# This is a workaround for a bug in setuptools: I'd like
+# to use the 'egg_info.writers' entry points in the setup()
+# call, but those don't work when also using a package_base
+# argument as we do.
+# (issue 123 in the distribute tracker)
+class egg_info (orig_egg_info.egg_info):
+ def run(self):
+ orig_egg_info.egg_info.run(self)
+
+ for hdr in ("pyobjc-compat.h", "pyobjc-api.h"):
+ fn = os.path.join("include", hdr)
+
+ write_header(self, fn, os.path.join(self.egg_info, fn))
if sys.version_info[0] == 3:
# FIXME: add custom test command that does the work.
@@ -365,6 +389,7 @@
Topic :: Software Development :: User Interfaces
""".splitlines())
+
dist = setup(
name = "pyobjc-core",
version = package_version(),
@@ -379,12 +404,18 @@
namespace_packages = ['PyObjCTools'],
package_dir = { '': 'Lib', 'PyObjCTest': 'PyObjCTest' },
extra_path = "PyObjC",
- cmdclass = {'build_ext': pyobjc_build_ext, 'install_lib': pyobjc_install_lib, 'build_py': oc_build_py, 'test': oc_test },
+ cmdclass = {'build_ext': pyobjc_build_ext, 'install_lib': pyobjc_install_lib, 'build_py': oc_build_py, 'test': oc_test, 'egg_info':egg_info },
options = {'egg_info': {'egg_base': 'Lib'}},
classifiers = CLASSIFIERS,
license = 'MIT License',
download_url = 'http://pyobjc.sourceforge.net/software/index.php',
test_suite='PyObjCTest.loader.makeTestSuite',
zip_safe = False,
+# entry_points = {
+# "egg_info.writers": [
+# "include/pyobjc-api.h = __main__:write_header",
+# "include/pyobjc-compat.h = __main__:write_header",
+# ],
+# },
**extra_args
)
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com