Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge in ahihi fork changes #18

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions build/config-mac.def
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# set PY_DEFAULT=0 if you manually installed Python on your system
# (overriding the one that came with OS X by default)
PY_DEFAULT=1
# which kind of Python installation to use
# system - macOS system default
# local - local installation
# conda - conda environment; specify the environment root dir using the
# PY_CONDA_ROOT environment variable
PY_KIND=conda

#########################################################################

Expand All @@ -11,15 +14,15 @@ PY_DEFAULT=1
# Mac OSX 10.6 -> default Python version (major.minor) = 2.6

PY_MAJOR_VERSION=2
PY_MINOR_VERSION=6
PY_MINOR_VERSION=7

#########################################################################

# uncomment if numpy/numarray/numeric support should be compiled in
# for info see http://numeric.scipy.org
# numarray and numeric are outdated

# PY_NUMPY=1
PY_NUMPY=1
# PY_NUMARRAY=1
# PY_NUMERIC=1

Expand Down
61 changes: 45 additions & 16 deletions build/gnumake-mac-gcc.inc
Original file line number Diff line number Diff line change
@@ -1,42 +1,71 @@
DEFS += -DPY_EXPORTS

ifdef PY_NUMPY
DEFS += -DPY_NUMPY
endif

ifdef PY_NUMARRAY
DEFS += -DPY_NUMARRAY
endif

ifdef PY_NUMERIC
DEFS += -DPY_NUMERIC
endif

ifdef PY_USE_GIL
DEFS += -DPY_USE_GIL
endif

ifdef PY_USE_INOFFICIAL
DEFS += -DPY_USE_INOFFICIAL
endif

ifeq ($(PY_KIND),conda)

ifndef PY_CONDA_ROOT
$(error PY_CONDA_ROOT is undefined)
endif

DEFS += -DPY_INTERPRETER=$(PY_CONDA_ROOT)/bin/python
LIBS += $(PY_CONDA_ROOT)/lib/libpython$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION).dylib
INCPATH += -I$(PY_CONDA_ROOT)/include
INCPATH += -I$(PY_CONDA_ROOT)/include/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
LDFLAGS += -rpath $(PY_CONDA_ROOT)/lib

ifdef PY_NUMPY
INCPATH += -I$(PY_CONDA_ROOT)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
endif

else

DEFS += -DPY_USE_FRAMEWORK

# don't use -framework Python, since this will stick to the default system version

_LOCAL_FRAMEWORK := /Library/Frameworks/Python.framework/Versions/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
_SYSTEM_FRAMEWORK := /System/Library/Frameworks/Python.framework/Versions/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
_LOCAL_LIBRARY := /Library/Python/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
_SYSTEM_LIBRARY := /System/Library/Python/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)

DEFS += -DPY_EXPORTS
INCPATH += -F/Library/Frameworks -framework Python

ifeq ($(PY_DEFAULT),1)
ifeq ($(PY_KIND),system)
LIBS += $(_SYSTEM_FRAMEWORK)/Python
INCPATH += -I$(_SYSTEM_FRAMEWORK)/Headers
else
LIBS += $(_LOCAL_FRAMEWORK)/Python
INCPATH += -I$(_LOCAL_FRAMEWORK)/Headers
endif

ifdef PY_NUMARRAY
DEFS += -DPY_NUMARRAY
endif
ifdef PY_NUMPY
DEFS += -DPY_NUMPY
INCPATH += -I$(_LOCAL_LIBRARY)/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
ifeq ($(PY_DEFAULT),1)

ifeq ($(PY_KIND),system)
INCPATH += -I$(_SYSTEM_FRAMEWORK)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
INCPATH += -I$(_SYSTEM_FRAMEWORK)/Extras/lib/python/numpy/core/include
else
INCPATH += -I$(_LOCAL_FRAMEWORK)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
endif
endif
ifdef PY_NUMERIC
DEFS += -DPY_NUMERIC
endif

ifdef PY_USE_GIL
DEFS += -DPY_USE_GIL
endif

ifdef PY_USE_INOFFICIAL
DEFS += -DPY_USE_INOFFICIAL
endif
21 changes: 20 additions & 1 deletion source/pybase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <ApplicationServices/ApplicationServices.h>
#endif

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)

static PyMethodDef StdOut_Methods[] =
{
{ "write", pybase::StdOut_Write, 1 },
{ "flush", pybase::StdOut_Flush, 1 },
{ NULL, NULL, }
};

Expand Down Expand Up @@ -98,8 +102,17 @@ void initsymbol();
void initsamplebuffer();
void initbundle();



void pybase::lib_setup()
{
{
#ifdef PY_INTERPRETER
{
static char py_program_name[] = TOSTRING(PY_INTERPRETER);
Py_SetProgramName(py_program_name);
}
#endif

post("");
post("------------------------------------------------");
post("py/pyext %s - python script objects",PY__VERSION);
Expand Down Expand Up @@ -776,6 +789,12 @@ PyObject* pybase::StdOut_Write(PyObject* self, PyObject* args)
return Py_None;
}

// dummy flush method, since some logging libraries call this
PyObject* pybase::StdOut_Flush(PyObject* self, PyObject* args)
{
Py_INCREF(Py_None);
return Py_None;
}

class work_data
{
Expand Down
1 change: 1 addition & 0 deletions source/pybase.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class pybase
};

static PyObject* StdOut_Write(PyObject* Self, PyObject* Args);
static PyObject* StdOut_Flush(PyObject* Self, PyObject* Args);
};

#endif
6 changes: 3 additions & 3 deletions source/pybuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#ifdef PY_ARRAYS

#ifdef PY_NUMARRAY
# if FLEXT_OS == FLEXT_OS_MAC
# ifdef PY_USE_FRAMEWORK
# include <Python/numarray/libnumarray.h>
# else
# include <numarray/libnumarray.h>
Expand All @@ -31,7 +31,7 @@ inline bool arrsupport() { return numtype != tAny; }
# if defined(PY_NUMPY)
# include <numpy/arrayobject.h>
# else
# if FLEXT_OS == FLEXT_OS_MAC
# ifdef PY_USE_FRAMEWORK
# include <Python/numarray/arrayobject.h>
# else
# include <numarray/arrayobject.h>
Expand Down Expand Up @@ -60,7 +60,7 @@ PyObject *pybase::py_arraysupport(PyObject *self,PyObject *args)
// PD defines a T_OBJECT symbol
#undef T_OBJECT

#if FLEXT_OS == FLEXT_OS_MAC
#ifdef PY_USE_FRAMEWORK
#include "Python/bufferobject.h"
#include "Python/structmember.h"
#else
Expand Down
2 changes: 1 addition & 1 deletion source/pybuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#error You need at least flext version 0.5.0
#endif

#if FLEXT_OS == FLEXT_OS_MAC
#ifdef PY_USE_FRAMEWORK
#include <Python/Python.h>
#else
#include <Python.h>
Expand Down
2 changes: 1 addition & 1 deletion source/pybundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#error You need at least flext version 0.5.0
#endif

#if FLEXT_OS == FLEXT_OS_MAC
#ifdef PY_USE_FRAMEWORK
#include <Python/Python.h>
#else
#include <Python.h>
Expand Down
2 changes: 1 addition & 1 deletion source/pyprefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
// otherwise some functions don't get defined
#include <cmath>

#if FLEXT_OS == FLEXT_OS_MAC
#ifdef PY_USE_FRAMEWORK
#include <Python/Python.h>
#else
#include <Python.h>
Expand Down
2 changes: 1 addition & 1 deletion source/pysymbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#error You need at least flext version 0.5.0
#endif

#if FLEXT_OS == FLEXT_OS_MAC
#ifdef PY_USE_FRAMEWORK
#include <Python/Python.h>
#else
#include <Python.h>
Expand Down