Page 1 of 1

Adding "other" libraries to Ren'Py

Posted: Wed Sep 02, 2015 4:36 pm
by nintendotoad
So there've been times where I wanted Ren'Py to do something somewhat odd - at this particular moment, I'd like it to be able to run lua scripts.

lunatic-python-bugfix seems to allow me to do this. Ignoring the fact that I'd have to compile it for 3-4 platforms, how would I add the binaries to Ren'Py in the first place so that the "import lua" line works?

At the moment, I'm staring at two built *.so files. I tried throwing them into the "renpy/lib/darwin-x86_64/lib/python2.7" area (seeing that I'm on Mac OS X at the moment). I ended up with the following problem:

Code: Select all

ImportError: dlopen(/Applications/renpy/renpy.app/Contents/MacOS/../../../lib/darwin-x86_64/lib/python2.7/lua.so, 2): Symbol not found: _PyUnicodeUCS2_FromFormat
  Referenced from: /Applications/renpy/renpy.app/Contents/MacOS/../../../lib/darwin-x86_64/lib/python2.7/lua.so
  Expected in: flat namespace
 in /Applications/renpy/renpy.app/Contents/MacOS/../../../lib/darwin-x86_64/lib/python2.7/lua.so

Re: Adding "other" libraries to Ren'Py

Posted: Thu Sep 03, 2015 1:25 am
by PyTom
You need to link against a wide unicode (UCS4) build of Python, which is what Ren'Py ships with. You built against a narrow build, which is why you have this problem.

Re: Adding "other" libraries to Ren'Py

Posted: Thu Sep 03, 2015 7:06 pm
by nintendotoad
That's what I had figured - but:

* if I'm on Mac OS X, Ren'Py 6.99.3.404, sys.maxunicode is 1114111
* if I'm on Windows, Ren'Py 6.99.5.602, sys.maxunicode is 65535

Is this me doing something wrong (or that's to be expected, and libraries for Windows should be built against UCS2 Python)?

Re: Adding "other" libraries to Ren'Py

Posted: Thu Sep 03, 2015 7:38 pm
by PyTom
Yeah, that's to be expected. The windows python build defaults to 16-bit.

Re: Adding "other" libraries to Ren'Py

Posted: Fri Sep 04, 2015 5:15 am
by nintendotoad
It looks like for one (POSIX? Cygwin? MinGW?) reason or several others, the libraries I was looking at couldn't actually work with Ren'Py when compiled for Windows (at least in the way that I was trying to build them):

https://pypi.python.org/pypi/lupa
https://pypi.python.org/pypi/lunatic-python-bugfix
https://code.google.com/p/lupy/

... Well that's 6 hours I'll never get back...
... Actually, Lupa works :)