[pypy-dev] update (+patch) on embedding pypy
Roberto De Ioris
roberto at unbit.it
Tue Mar 27 14:16:18 CEST 2012
Hi everyone, i have finally managed to have a pypy plugin into uWSGI via
The first step was exporting a bunch of symbols in libpypy-c:
"RPython_StartupCode", "pypy_g_ObjSpace_startup", "pypy_g_call_startup",
pypy_g_ObjSpace_startup and pypy_g_Module_startup are not strictly
required, i have used them only for debugging some very specific areas.
Attached there is a patch for latest tip.
After that, i have defined a Py_Initialize() replacement:
and placed a bunch of #ifdef for unsupported functions
Finally i have built libpypy with
pypy translate.py -Ojit --shared
and the uWSGI plugin with
LDFLAGS="-L." pypy-c uwsgiconfig.py --plugin plugins/pypy core
(LDFLAGS is used as i have libpypy-c in the current dir)
Run uWSGI with the welcome app (and a bunch of processes):
uwsgi --http-socket :8080 --plugin pypy --module welcome --master
Incredibly the whole uwsgi api (that it is pretty complex, involving tons
of c code) works flawlessly as well as the custom wsgi.input object (the
whole upload test suite passes).
Running python threads from the WSGI app works too, but mapping python
threads to already available pthreads is a no go (all explodes, i will
investigate on that)
Importing applications as modules works normally, but importing via file
requires implementing a bunch of c-api in pypy (i will address that soon)
virtualenv, sys.argv and setting programname is not supported (no c api
available) i can get rid of this too in the next few days.
Important thing: i have tested it only on OSX
Roberto De Ioris
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2181 bytes
Desc: not available
More information about the pypy-dev