From: Kevin A. <al...@se...> - 2001-11-10 03:21:10
|
I think py2exe gets very confused by how the PythonCard apps load or rather the extra files it loads during initialization. The good news is that after changing the paths to the config file (pythoncard.config.py) and spec file (spec.py) I got a working .exe. So, given a slightly modified version of the framework, it is possible to build standalone PythonCardPrototype apps on Windows. Sweet! Details follow... I tried it with the minimal sample. py2exe ended up including tcl, due to the PIL import in graphic.py. If PIL isn't available, then tcl and PIL are skipped. I'm not entirely sure which names to specify with the -e option to exclude tcl and/or PIL, so I just commented out the imports and set PIL_FOUND = 0 in graphic.py. Of course, if your app used PIL, you would want it included, so the question is then whether you need tcl? I used the this command-line to build minimal: python setup.py py2exe Here's the setup.py script: from distutils.core import setup import py2exe setup( name = "minimal", scripts = ["minimal.py"] ) The resulting output files in dist\minimal with file sizes in bytes: 57344 Jul 26 12:40 PyWinTypes21.dll 49236 Jul 26 12:39 _sre.pyd 477563 Nov 9 19:08 minimal.exe 708696 Jul 26 12:38 python21.dll 364544 Jul 10 13:39 stc_c.pyd 147456 Jul 10 13:36 utilsc.pyd 57439 Jul 26 12:46 win32api.pyd 2080256 Jul 6 12:37 wx23_1.dll 1576960 Jul 10 13:35 wxc.pyd The two changes necessary in the current framework to do a build were: config.py, line 25, change how the 'pythoncard.config.py' or 'pythoncard.user.config.py' is loaded changed: #basePath = os.path.dirname( os.path.abspath( __file__ ) ) to: basePath = "" res.py, line 40, change loading of spec.py changed: #specPath = os.path.join( thisDir, 'spec.py' ) to: specPath = "spec.py" These changes were against release 0.5, which is the same as what's in cvs. I then copied the spec.py and pythoncard.config.py files to the minimal.py directory so they would be found while the .exe was being built. minimal.py, lines 20 and 21, hard-coded the resource file name #base, ext = os.path.splitext(sys.argv[0]) #filename = base + ".rsrc.py" filename = "minimal.rsrc.py" Normally, spec.py and pythoncard.config.py are in the package directory. Maybe Thomas will has some suggestions on dealing with path issues like this? I'm pretty sure the abspath() call was added for finding the files because we had trouble with file loading under Linux when you didn't run a sample from the package directory. I skipped trying to fix some of the paths in model.py for loading the pycrustrc.py files, so that could probably use some work to. Finally, I didn't attempt to comment out PyCrust, so the app I ended up building can still show all the debug windows, which would be needed for something like the turtle sample. ka -----Original Message----- From: Robin Dunn [mailto:ro...@al...] Sent: Friday, November 09, 2001 2:41 PM To: Kevin Altis; tho...@io... Subject: Re: py2exe minimal PythonCard app build > > If there is a wxPython example that would be similar I would like to look at > that. Go to wxPython/samples/doodle, run "python setup.py py2exe -w" and then look for superdoodle.exe under the dist folder. It's an extremely simple example, so some other py2exe or distutils work may have to be done to get it right for a PythonCard app, but it shouldn't be too difficult. -- Robin Dunn Software Craftsman ro...@Al... Java give you jitters? http://wxPython.org Relax with wxPython! |