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

PR for SopiMlab fork #20

Open
wants to merge 43 commits into
base: python-3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
38f3d28
Changes for python3 compilation
grrrr May 7, 2018
b23904c
Bashed string/unicode and int/long inconsistencies
grrrr Jun 20, 2019
260c441
Buffer fixed
grrrr Jun 20, 2019
7764061
support conda python
ahihi Aug 7, 2019
21e3b32
add conda lib dir to rpath
ahihi Aug 8, 2019
ac328cd
add dummy StdOut_Flush() method to make absl logging happy
ahihi Aug 14, 2019
1f7e520
call Py_SetProgramName() when building for conda env
ahihi Aug 16, 2019
8308d8a
don't include <Python/Python.h> when using conda
ahihi Aug 27, 2019
0c800aa
more conda fixing
ahihi Aug 27, 2019
1884683
Merge branch 'master' of https://github.com/grrrr/py
ahihi Mar 9, 2020
df8fa8f
Merge branch 'master' into python3
ahihi Mar 9, 2020
c0b374e
python 3 compatibility fixes
ahihi Mar 10, 2020
99abb6a
support pymalloc python build
ahihi Mar 10, 2020
379ab50
reorganize module defs & fix builtins import
ahihi Mar 10, 2020
34c529e
fix module init
ahihi Mar 10, 2020
22e9601
fix python 2 build
ahihi Mar 10, 2020
4ec81db
more python 3 fixing... simple-1.pd now works
ahihi Mar 17, 2020
6e8ea82
python 3 - simple-2.pd now working
ahihi Mar 17, 2020
4408d3d
fix script.py for python 3, fix simple.py docstring
ahihi Mar 17, 2020
a32b6db
more python 3 compat work on example scripts
ahihi Mar 17, 2020
daa5543
first shot at pybuffer in py3. still buggy...
ahihi Mar 23, 2020
e3dfb2e
handle Pd array memory layout using strides
ahihi Mar 30, 2020
ec04393
fix numpy buffer format
ahihi Mar 30, 2020
e6782e7
port sig.py to python3 and fix dsp buffer handling
ahihi Mar 31, 2020
aaaf6c1
port sendrecv.py to python3
ahihi Mar 31, 2020
e8a95d7
untabify simple.py
ahihi Mar 31, 2020
36416a5
define pyext class using PyTypeObject
ahihi Apr 6, 2020
f0a6ee1
string.swapcase is gone in py3, use capwords as example instead
ahihi Apr 7, 2020
a6e7a76
compat fixes to examples
ahihi Apr 7, 2020
27020c4
cleanup
ahihi Apr 7, 2020
5a2bca7
cleanup
ahihi Apr 7, 2020
2737539
unbreak python 2
ahihi Apr 7, 2020
cc2ad77
add _canvas_dir attribute
ahihi Sep 7, 2020
0e35ed1
fix(?) "pyext." behavior
ahihi Sep 7, 2020
630fcdb
make conda build work on linux
ahihi Nov 10, 2020
bc0708f
fix some uninitialized memory bugs found by valgrind
ahihi Nov 30, 2020
a55581f
add SOPI notice to readme
ahihi May 31, 2021
90d8d55
Update readme.txt
SopiMlab Jun 1, 2021
d1c67df
update readme
ahihi Jun 1, 2021
839982b
Merge branch 'master' of github.com:SopiMlab/py
ahihi Jun 1, 2021
eb442e9
update readme
ahihi Jun 1, 2021
bff4938
Update readme.txt
SopiMlab Jun 1, 2021
35138a0
Update readme.txt
SopiMlab Jun 1, 2021
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
10 changes: 9 additions & 1 deletion build/config-lnx.def
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# what is the base prefix of the Python installation?
ifdef PY_CONDA_ROOT
PYTHONPREFIX=$(PY_CONDA_ROOT)
else
PYTHONPREFIX=/usr
endif

# which Python version do you want to compile against?
PYTHONVERSION=2.7
PY_MAJOR_VERSION=3
PY_MINOR_VERSION=7

# uncomment if numpy/numarray/numeric support should be compiled in
# for info see http://numeric.scipy.org
Expand All @@ -15,3 +20,6 @@ PY_USE_GIL=1

# use inofficial (pure data) functionality
# PY_USE_INOFFICIAL=1

# use python with pymalloc (look for "pythonX.Ym" files)
PY_USE_PYMALLOC=1
18 changes: 12 additions & 6 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 @@ -10,16 +13,16 @@ PY_DEFAULT=1
# Mac OSX 10.5 -> default Python version (major.minor) = 2.5
# Mac OSX 10.6 -> default Python version (major.minor) = 2.6

PY_MAJOR_VERSION=2
PY_MINOR_VERSION=6
PY_MAJOR_VERSION=3
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 All @@ -30,3 +33,6 @@ PY_USE_GIL=1

# use inofficial (pure data) functionality
# PY_USE_INOFFICIAL=1

# use python with pymalloc (look for "pythonX.Ym" files)
PY_USE_PYMALLOC=1
15 changes: 15 additions & 0 deletions build/gnumake-lnx-gcc.inc
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
ifdef PY_USE_PYMALLOC
PYTHONVERSION=$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)m
else
PYTHONVERSION=$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
endif

DEFS += -DPY_EXPORTS

INCPATH += -I$(PYTHONPREFIX)/include/python$(PYTHONVERSION)

ifdef PY_CONDA_ROOT
LIBPATH += -L$(PY_CONDA_ROOT)/lib
LDFLAGS += -Wl,-R$(PY_CONDA_ROOT)/lib
DEFS += -DPY_INTERPRETER=$(PY_CONDA_ROOT)/bin/python
endif

LIBS += -lpython$(PYTHONVERSION)

ifdef PY_NUMARRAY
DEFS += -DPY_NUMARRAY
endif
ifdef PY_NUMPY
DEFS += -DPY_NUMPY
INCPATH += -I$(PYTHONPREFIX)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
endif
ifdef PY_NUMERIC
DEFS += -DPY_NUMERIC
Expand Down
67 changes: 52 additions & 15 deletions build/gnumake-mac-gcc.inc
Original file line number Diff line number Diff line change
@@ -1,42 +1,79 @@
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
INCPATH += -I$(PY_CONDA_ROOT)/include
ifdef PY_USE_PYMALLOC
INCPATH += -I$(PY_CONDA_ROOT)/include/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)m
LIBS += $(PY_CONDA_ROOT)/lib/libpython$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)m.dylib
else
INCPATH += -I$(PY_CONDA_ROOT)/include/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
LIBS += $(PY_CONDA_ROOT)/lib/libpython$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION).dylib
endif
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
#DEBUG = 1
#DFLAGS += -DFLEXT_DEBUG
4 changes: 2 additions & 2 deletions package.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ SRCS= \
py.cpp pyext.cpp modmeth.cpp clmeth.cpp \
register.cpp bound.cpp pyargs.cpp \
pysymbol.cpp pybuffer.cpp pybundle.cpp pydsp.cpp \
pyatom.cpp pybase.cpp pymeth.cpp
pyatom.cpp pybase.cpp pymeth.cpp pycompat.cpp

HDRS= pyprefix.h main.h pyext.h pysymbol.h pybuffer.h pybundle.h pyatom.h pybase.h
HDRS= pyprefix.h main.h pyext.h pysymbol.h pybuffer.h pybundle.h pyatom.h pybase.h pycompat.h
48 changes: 24 additions & 24 deletions pd/methods-1.pd
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#N canvas 540 469 734 369 12;
#X obj 16 13 cnv 15 650 40 empty empty py/pyext 10 22 0 24 -260818
-1 0;
#X text 235 32 http://grrrr.org/ext;
#X symbolatom 21 139 10 0 0 0 - - -;
#X symbolatom 25 298 10 0 0 0 - - -;
#X obj 22 179 py .str @py 1;
#X text 145 170 convert the symbol to a Python string;
#X text 35 216 pass it as a true Python object;
#X symbolatom 364 295 10 0 0 0 - - -;
#X text 462 269 use module function;
#X text 23 119 enter some text;
#X text 145 187 using the built-in str function;
#X obj 25 252 pym swapcase;
#X text 63 270 use swapcase method;
#X obj 363 250 py string.swapcase;
#X text 235 16 Python script objects \, (C)2003-2006 Thomas Grill;
#X text 21 73 Py can act on Python objects in an object-oriented manner
;
#X connect 2 0 4 1;
#X connect 4 0 11 1;
#X connect 4 0 13 1;
#X connect 11 0 3 0;
#X connect 13 0 7 0;
#N canvas 540 469 734 369 12;
#X obj 16 13 cnv 15 650 40 empty empty py/pyext 10 22 0 24 -260818
-1 0;
#X text 235 32 http://grrrr.org/ext;
#X symbolatom 21 139 10 0 0 0 - - -;
#X symbolatom 25 298 10 0 0 0 - - -;
#X obj 22 179 py .str @py 1;
#X text 145 170 convert the symbol to a Python string;
#X text 35 216 pass it as a true Python object;
#X symbolatom 364 295 10 0 0 0 - - -;
#X text 462 269 use module function;
#X text 23 119 enter some text;
#X text 145 187 using the built-in str function;
#X obj 25 252 pym swapcase;
#X text 63 270 use swapcase method;
#X text 235 16 Python script objects \, (C)2003-2006 Thomas Grill;
#X text 21 73 Py can act on Python objects in an object-oriented manner
;
#X obj 363 250 py string.capwords;
#X connect 2 0 4 1;
#X connect 4 0 11 1;
#X connect 4 0 15 1;
#X connect 11 0 3 0;
#X connect 15 0 7 0;
Loading