Csound Csound-dev Csound-tekno Search About

[Cs-dev] Moving to Python 2.5 (not yet committed)

Date2007-05-02 03:37
From"Michael Gogins"
Subject[Cs-dev] Moving to Python 2.5 (not yet committed)
I have ported Csound and CsoundVST from Python version 2.4 to Python version 
2.5. This affects the csnd Python extension module and the CsoundVST Python 
extension module as well as the Lua, Java, and Lisp APIs.

A large number of changes were required, because with Python 2.5, extension 
module shared libraries MUST use .pyd as their filename extensions. However, 
this causes problems or changes for other clients of the csnd and CsoundVST 
libraries, especially CsoundVST as a Cubase plugin and csnd as a Lua module.

Therefore, I have factored out all SWIG-generated Python stub code into 
_csnd.pyd (used to be _csnd.dll) and _CsoundVST.pyd (used to be 
_CsoundVST.dll). The rest of the code that used to be in _csnd.dll is now in 
csnd.dll, and the rest of the code that used to be in _CsoundVST.dll is now 
in CsoundVST.dll, which now accord with standard naming conventions for 
Windows shared libraries.

In order to make this work, _csnd.pyd must dynamically link with csnd.dll, 
and _CsoundVST.pyd must dynamically link with CsoundVST.dll. This, in turn, 
has required exporting many previously un-exported classes and functions in 
csnd.dll and CsoundVST.dll. I also had to move all message callback APIs 
into csound.h and csound.c.

So far, I have only done this work for Windows. I have made the 
corresponding changes for Linux, but not yet tested them, though I expect 
them to work with minimal effort.

Unfortunately, I do not even know if this strategy will work on OS X, nor do 
I know enough about that operating system to implement it. We will need 
somebody else to do this work.

However, it is CERTAIN that the .pyd extension MUST be used for Python 2.5, 
and it is equally certain that the .pyd extension WILL NOT work for a VST 
plugin. (Java, Lua, and Lisp each load modules by full name, so this issue 
does not exist for them.)

Note that the .pyd modules should also work if compiled for earlier versions 
of Python, such as version 2.4.

I have not yet committed these changes. I plan to commit them in the next 
few days, after reviewing any comments you may have.

Regards,
Mike 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2007-05-03 02:03
FromAnthony Kozar
SubjectRe: [Cs-dev] Moving to Python 2.5 (not yet committed)
This topic does interest me since I have dabbled with the Python interface
on OS 9 and have had at least one user using it on OS 9 as well.

I am currently compiling with Python 2.2.1.  The last time that I compiled
the Python interface library was Csound 5.01 though, and that required that
I use SWIG on OS X, because the OS 9 version is too old now for Csound.

>From what you've said, it sounds like the changes will still work with 2.4
and probably 2.3.  Do you have any idea whether they might work with 2.2?
The changes sound like they are too extensive to simply #ifdef for different
versions.  Is this correct?

Have the Lua, Java, and Lisp APIs actually changed in how they are used, or
is it just that the library has been split into pieces?

Anthony

Michael Gogins wrote on 5/1/07 10:37 PM:

> I have ported Csound and CsoundVST from Python version 2.4 to Python version
> 2.5. This affects the csnd Python extension module and the CsoundVST Python
> extension module as well as the Lua, Java, and Lisp APIs.

> I also had to move all message callback APIs
> into csound.h and csound.c.

> Note that the .pyd modules should also work if compiled for earlier versions
> of Python, such as version 2.4.

> I have not yet committed these changes. I plan to commit them in the next
> few days, after reviewing any comments you may have.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2007-05-12 23:08
Fromsome_greek_guy
SubjectRe: [Cs-dev] Moving to Python 2.5 (not yet committed)


Michael Gogins wrote:
> 
> I have ported Csound and CsoundVST from Python version 2.4 to Python
> version 
> 2.5. This affects the csnd Python extension module and the CsoundVST
> Python 
> extension module as well as the Lua, Java, and Lisp APIs.
> 
> 
That's great news!!! I 've been looking forward to it for a long time. I am
eager to try it myself.
Best regards
Nick
-- 
View this message in context: http://www.nabble.com/Moving-to-Python-2.5-%28not-yet-committed%29-tf3678432.html#a10450212
Sent from the Csound - Dev mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2007-05-13 17:56
FromAndres Cabrera
Subject[Cs-dev] Can't build python interface
Hi all,

I've got Python 2.5 (and dev packages) now, I've set pytonVersion to 2.5
in SConstruct, I've deleted interfaces/python_interface_wrap.cc and
interfaces/python_interface_wrap.h, so they're recreated, but I can't
build the pyhton interface. My SWIG version is 1.3.29. Any ideas?


Cheers,
Andrés

CONFIGURATION DECISION: Building with new parser enabled
CONFIGURATION DECISION: Building static Csound library
Parsed fltk-config.
CONFIGURATION DECISION: Building Csound interfaces library.
Python Version: 2.5
CONFIGURATION DECISION: Not building Java wrappers for Csound interfaces
library.
CONFIGURATION DECISION: Not building Csound Lua interface library.
PYTHON MODULE..........
CONFIGURATION DECISION: Not generating PDF documentation.
CONFIGURATION DECISION: Not building Virtual Keyboard plugin. (FLTK
1.1.7+ required)
CONFIGURATION DECISION: Not building CoreAudio plugin.
CONFIGURATION DECISION: Building ALSA plugin.
CONFIGURATION DECISION: Building PortAudio module.
Adding Jack library for PortAudio
CONFIGURATION DECISION: Building JACK plugin.
CONFIGURATION DECISION: Not building with PortMIDI.
CONFIGURATION DECISION: Building OSC plugin.
CONFIGURATION DECISION: Building UDP plugins.
Checking for C header file fluidsynth.h... (cached) yes
CONFIGURATION DECISION: Building fluid opcodes.
CONFIGURATION DECISION: Building vst4cs opcodes.
CONFIGURATION DECISION: Not building Loris Python extension and Csound
opcodes.
CONFIGURATION DECISION: Not building STK opcodes.
CONFIGURATION DECISION: Building Python opcodes.
CONFIGURATION DECISION: Building FLTK GUI CSOUND5GUI frontend.
CONFIGURATION DECISION: Not building CsoundVST plugin and standalone.
CONFIGURATION DECISION: Building Tclcsound frontend
CONFIGURATION DECISION: Building Winsound frontend
CONFIGURATION DECISION: Not building OSX GUI frontend
Checking for C header file ladspa.h... (cached) yes
CONFIGURATION DECISION: Building DSSI plugin host opcodes.
CONFIGURATION DECISION: Not calling TAGS
CONFIGURATION DECISION: Calling makedb
CONFIGURATION DECISION: Not compiling zip file for release.
scons: done reading SConscript files.
swig -c++ -includeall -verbose -DLINUX -DPIPES -DHAVE_LIBSNDFILE=1016
-DHAVE_FLTK -DBETA -DHAVE_SOCKETS -DHAVE_FCNTL_H -DHAVE_UNISTD_H
-DHAVE_STDINT_H -DHAVE_SYS_TIME_H -DHAVE_SYS_TYPES_H -DHAVE_TERMIOS_H
-DHAVE_SOCKETS -DHAVE_DIRENT_H -DENABLE_NEW_PARSER
-D__BUILDING_LIBCSOUND -D__BUILDING_CSOUND_INTERFACES -I. -I./H
-I/home/andres/src/portaudio/include -I/usr/local/include/vst
-I/usr/local/include -I/usr/include -I/usr/X11R6/include -Iinterfaces
-python -outdir . -o interfaces/python_interface_wrap.cc
interfaces/python_interface.i
LibDir: python
   ./
   ./
   ./H/
   /home/andres/src/portaudio/include/
   /usr/local/include/vst/
   /usr/local/include/
   /usr/include/
   /usr/X11R6/include/
   interfaces/
   /usr/share/swig1.3/python/
   ./swig_lib/python/
   /usr/share/swig1.3/config/
   ./swig_lib/config/
   /usr/share/swig1.3/
   ./swig_lib/
Preprocessing...
Starting language-specific parse...
Processing types...
C++ analysis...
Generating wrappers...
./H/csound.h:243: Warning(451): Setting a const char * variable may leak
memory.
interfaces/cs_glue.hpp:507: Warning(473): Returning a pointer or
reference in a director method is not recommended.
g++ -o interfaces/python_interface_wrap.os -c -fexceptions -Wall -g -O2
-DLINUX -DPIPES -fPIC -DHAVE_LIBSNDFILE=1016 -DHAVE_FLTK -DBETA
-DHAVE_SOCKETS -DHAVE_FCNTL_H -DHAVE_UNISTD_H -DHAVE_STDINT_H
-DHAVE_SYS_TIME_H -DHAVE_SYS_TYPES_H -DHAVE_TERMIOS_H -DHAVE_SOCKETS
-DHAVE_DIRENT_H -DENABLE_NEW_PARSER -D__BUILDING_LIBCSOUND -I. -IH
-I/home/andres/src/portaudio/include -I/usr/local/include/vst
-I/usr/local/include -I/usr/include -I/usr/X11R6/include -Iinterfaces
-I/usr/include/python2.5 -I/usr/local/include/python2.5
interfaces/python_interface_wrap.cc
interfaces/python_interface_wrap.cc: In function 'int
SWIG_Python_ConvertFunctionPtr(PyObject*, void**, swig_type_info*)':
interfaces/python_interface_wrap.cc:2052: error: invalid conversion from
'const char*' to 'char*'
interfaces/python_interface_wrap.cc: In function 'int
SWIG_AsPtr_std_string(PyObject*, std::string**)':
interfaces/python_interface_wrap.cc:4339: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'int
SWIG_AsVal_bool(PyObject*, bool*)':
interfaces/python_interface_wrap.cc:4924: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:4927: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_csoundAppendOpcode(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:10134: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:10140: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:10146: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_csoundCreateThread(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:10473: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_csoundSetChannelIOCallback(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:11567: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_csoundSetCallback(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:11927: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_csoundRemoveCallback(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:11965: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_Csound_AppendOpcode(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:19028: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:19034: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:19040: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_Csound_SetChannelIOCallback(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:20878: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_IntToStringMap_erase__SWIG_1(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:28397: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_IntToStringMap_erase__SWIG_2(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:28437: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:28448: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_IntToStringMap_erase(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:28483: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:28510: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:28514: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_MyfltVector_erase__SWIG_0(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:33874: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_MyfltVector_erase__SWIG_1(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:33916: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:33927: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_MyfltVector_erase(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:33963: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:33976: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:33980: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_MyfltVector_insert__SWIG_0(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:34320: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_MyfltVector_insert__SWIG_1(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:34372: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'PyObject*
_wrap_MyfltVector_insert(PyObject*, PyObject*)':
interfaces/python_interface_wrap.cc:34418: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc:34437: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In function 'void
SWIG_Python_FixMethods(PyMethodDef*, swig_const_info*, swig_type_info**,
swig_type_info**)':
interfaces/python_interface_wrap.cc:36933: error: invalid conversion
from 'const char*' to 'char*'
interfaces/python_interface_wrap.cc: In static member function 'static
int swig::traits_asptr,
std::allocator > > >::asptr(PyObject*,
std::map, std::allocator > >**) [with K = int, T = std::basic_string, std::allocator >]':
interfaces/python_interface_wrap.cc:3545:   instantiated from 'int
swig::asptr(PyObject*, Type**) [with Type = std::map, std::allocator >,
std::less, std::allocator, std::allocator > >
> >]'
interfaces/python_interface_wrap.cc:27831:   instantiated from here
interfaces/python_interface_wrap.cc:4620: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In static member function 'static
int swig::traits_asptr_stdseq::asptr(PyObject*, Seq**) [with Seq
= std::map,
std::allocator >, std::less, std::allocator,
std::allocator > > > >, T = std::pair, std::allocator > >]':
interfaces/python_interface_wrap.cc:4617:   instantiated from 'static
int swig::traits_asptr,
std::allocator > > >::asptr(PyObject*,
std::map, std::allocator > >**) [with K = int, T = std::basic_string, std::allocator >]'
interfaces/python_interface_wrap.cc:3545:   instantiated from 'int
swig::asptr(PyObject*, Type**) [with Type = std::map, std::allocator >,
std::less, std::allocator, std::allocator > >
> >]'
interfaces/python_interface_wrap.cc:27831:   instantiated from here
interfaces/python_interface_wrap.cc:4557: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In static member function 'static
int swig::traits_asptr_stdseq::asptr(PyObject*, Seq**) [with Seq
= std::vector >, T = float]':
interfaces/python_interface_wrap.cc:4861:   instantiated from 'static
int swig::traits_asptr >
>::asptr(PyObject*, std::vector >**) [with T =
float]'
interfaces/python_interface_wrap.cc:3545:   instantiated from 'int
swig::asptr(PyObject*, Type**) [with Type = std::vector >]'
interfaces/python_interface_wrap.cc:33077:   instantiated from here
interfaces/python_interface_wrap.cc:4557: warning: dereferencing
type-punned pointer will break strict-aliasing rules
interfaces/python_interface_wrap.cc: In static member function 'static
int swig::traits_asptr >::asptr(PyObject*,
std::pair<_T1, _T2>**) [with T = int, U = std::basic_string, std::allocator >]':
interfaces/python_interface_wrap.cc:3545:   instantiated from 'int
swig::asptr(PyObject*, Type**) [with Type = std::pair, std::allocator > >]'
interfaces/python_interface_wrap.cc:3667:   instantiated from 'static
bool swig::traits_check::check(PyObject*)
[with Type = std::pair, std::allocator > >]'
interfaces/python_interface_wrap.cc:3674:   instantiated from 'bool
swig::check(PyObject*) [with Type = std::pair, std::allocator > >]'
interfaces/python_interface_wrap.cc:4278:   instantiated from 'bool
swig::PySequence_Cont::check(bool) const [with T = std::pair, std::allocator > >]'
interfaces/python_interface_wrap.cc:4545:   instantiated from 'static
int swig::traits_asptr_stdseq::asptr(PyObject*, Seq**) [with Seq
= std::map,
std::allocator >, std::less, std::allocator,
std::allocator > > > >, T = std::pair, std::allocator > >]'
interfaces/python_interface_wrap.cc:4617:   instantiated from 'static
int swig::traits_asptr,
std::allocator > > >::asptr(PyObject*,
std::map, std::allocator > >**) [with K = int, T = std::basic_string, std::allocator >]'
interfaces/python_interface_wrap.cc:3545:   instantiated from 'int
swig::asptr(PyObject*, Type**) [with Type = std::map, std::allocator >,
std::less, std::allocator, std::allocator > >
> >]'
interfaces/python_interface_wrap.cc:27831:   instantiated from here
interfaces/python_interface_wrap.cc:4485: warning: dereferencing
type-punned pointer will break strict-aliasing rules
scons: *** [interfaces/python_interface_wrap.os] Error 1
scons: building terminated because of errors.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2007-05-13 18:33
Fromroot
SubjectRe: [Cs-dev] Can't build python interface
Again it looks as if SWIG is generating incorrect code

interfaces/python_interface_wrap.cc: In function 'int
SWIG_Python_ConvertFunctionPtr(PyObject*, void**, swig_type_info*)':
interfaces/python_interface_wrap.cc:2052: error: invalid conversion from
'const char*' to 'char*'

What I usually do in these cases is to edit the generated code by hand and 
then run scons again.

==John ff



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net