diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2007-02-10 03:20:57 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2007-02-10 03:20:57 +0000 |
commit | 62a37c60ddce222ff2968b21e47a77c5a854c657 (patch) | |
tree | b19b40f76335426d84fd2d8216f9c7bb56e866eb /externals | |
parent | 486cb8958d1a99a3cbe98e3904256e7268533b00 (diff) |
fixing numpy initialization quirks
svn path=/trunk/; revision=7416
Diffstat (limited to 'externals')
-rw-r--r-- | externals/grill/py/py.xcodeproj/project.pbxproj | 32 | ||||
-rw-r--r-- | externals/grill/py/source/pybuffer.cpp | 17 |
2 files changed, 35 insertions, 14 deletions
diff --git a/externals/grill/py/py.xcodeproj/project.pbxproj b/externals/grill/py/py.xcodeproj/project.pbxproj index c46e16e1..ae60f114 100644 --- a/externals/grill/py/py.xcodeproj/project.pbxproj +++ b/externals/grill/py/py.xcodeproj/project.pbxproj @@ -347,29 +347,31 @@ DYLIB_CURRENT_VERSION = 1; EXECUTABLE_EXTENSION = pd_darwin; GCC_ALTIVEC_EXTENSIONS = YES; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_MODEL_CPU = G4; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = source/pyprefix.h; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", "FLEXT_SYS=2", FLEXT_DEBUG, - FLEXT_THREADS, + FLEXT_SHARED, ); HEADER_SEARCH_PATHS = ( + "$(inherited)", "$(flext)/source", "$(PD-devel)/src", ); INSTALL_PATH = "$(PDApp)/extra"; LIBRARY_SEARCH_PATHS = "$(flext)/build"; LIBRARY_STYLE = STATIC; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; OPTIMIZATION_CFLAGS = "-O0"; OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-undefined", + dynamic_lookup, + "-lflext-pd_d", + ); OTHER_REZFLAGS = ""; PRODUCT_NAME = py; SECTORDER_FLAGS = ""; @@ -400,6 +402,7 @@ FLEXT_SHARED, ); HEADER_SEARCH_PATHS = ( + "$(inherited)", "$(flext)/source", "$(PD-devel)/src", ); @@ -408,6 +411,11 @@ LIBRARY_STYLE = DYNAMIC; MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-undefined", + dynamic_lookup, + "-lflext-pd", + ); OTHER_REZFLAGS = ""; PRODUCT_NAME = py; SECTORDER_FLAGS = ""; @@ -569,14 +577,22 @@ E93C2D8E0A5DB6E70023B566 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_PREPROCESSOR_DEFINITIONS = PY_NUMERIC; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = PY_NUMPY; + HEADER_SEARCH_PATHS = "/Library/Python/2.3/site-packages/numpy/core/include/"; }; name = Development; }; E93C2D8F0A5DB6E70023B566 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_PREPROCESSOR_DEFINITIONS = PY_NUMERIC; + ARCHS = ( + i386, + ppc, + ); + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PREPROCESSOR_DEFINITIONS = PY_NUMPY; + HEADER_SEARCH_PATHS = "/Library/Python/2.3/site-packages/numpy/core/include/"; }; name = Deployment; }; diff --git a/externals/grill/py/source/pybuffer.cpp b/externals/grill/py/source/pybuffer.cpp index c375aa63..5452c254 100644 --- a/externals/grill/py/source/pybuffer.cpp +++ b/externals/grill/py/source/pybuffer.cpp @@ -2,7 +2,7 @@ py/pyext - python script object for PD and Max/MSP -Copyright (c)2002-2006 Thomas Grill (gr@grrrr.org) +Copyright (c)2002-2007 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -761,16 +761,21 @@ PyTypeObject pySamplebuffer_Type = { buffer_new, /* tp_new */ }; -void initsamplebuffer() +// Must have this as a function because the import_array macro in numpy version 1.01 strangely has a return statement included. +// Furthermore the import error printout from this macro is ugly, but we accept that for more, waiting for later numpy updates to fix all of this. +static void __import_array__() { - PyErr_Clear(); - -#ifdef PY_ARRAYS #ifdef PY_NUMARRAY import_libnumarray(); #else - import_array(); + import_array(); #endif +} + +void initsamplebuffer() +{ +#ifdef PY_ARRAYS + __import_array__(); if(PyErr_Occurred()) // catch import error PyErr_Clear(); |