Sunday, October 01, 2006

Py2App success

I did the following test with CherryPy and Standalone DTML from Zope:


import cherrypy
import DocumentTemplate
import os
import sqlobject

class Root:
def index(self):
return DocumentTemplate.HTML("Hoy! <dtml-var test>", test="Woa!")
index.exposed = True

if __name__ == "__main__":
cherrypy.root = Root()
cherrypy.config.update(file="./test.conf")
cherrypy.server.start()


After 1 hour figuring out what I need to include and how, finally Py2App had generated for me TWELVE MEGABYTES APPLICATION for this test with an Universal binary. Notice the dot-slash before test.conf — it searches from $YOUR_APP/Contents/Resources/ path, instead of $YOUR_APP/Contents/MacOS/. And I still have to screw up the result by removing sources with .py extensions, leaving only .pyc instead. Well, cx_Freeze with wxWindows isn't that better either: http://wiki.wxpython.org/index.cgi/CreatingStandaloneExecutables.

Running this thing on another PowerPC Mac succeeded. Previously I tried cx_Freeze 3.0.3 (source is here) on my Mac under 10.4.8 Tiger and it does not succeeded, since Python interpreter won't find some Python-dependent library, path of which was hardcoded inside the binary. Sweet. :-(

No comments: