This commit add support for a series o cpython-compatible api functions required for embedding libpypy in c apps. They are all written in rpython (as cpyext) except for Py_Initialize requiring a call to RPython_StartupCode.
Tested with uWSGI tip.
I'm OK to leave it simple to begin with; but pypy.file will hardcode the path of the pypy source tree, at translation time.
Is sys.path correctly set if one donwloads the nightly builds and unpack it anywhere? Should the code use sys.executable somehow?
honestly it is not clear to me how to make 'srcdir' independent from pypy.file Apps embeding python normally set sys.executable to their binary path, so following that value could lead to problems. Maybe we could take the absolute path of libpypy-c with dladdr() trick, but this is glibc specific.
You are right of course. I did embed a Python interpreter several times, but I forgot that PythonHome and Path should almost always be overridden. Since pypy does not use sys.prefix, defaulting to the original source path is the right thing to do.