I decided to try and use ppackage.
I took the example pdef file:
class mypackage(package): file(Filename('neededfile.dll')) module('my.python.module') dir(Filename('/c/my/root_dir'))
(From panda3d.org/manual/index.php/The_pdef_syntax )
and tried it. It throws an exception:
Well, thats kinda lame. So off I went to debug, starting with looking at “direct/src/p3d/Packager.py” as recommended. That path does not exist though. Inside Panda3D/lib I do have direct/p3d/Packager.py so I looked in there. Well over 3000 lines of python is not the best file format specification, but I’ll take what I can get.
Filename is used in there, but not defined or imported as far as I can tell. I think its coming in through a * import, which stylistically shouldn’t be used for this reason. Oh well.
Anyway, looking through Packager.py seems to suggest that I can use Filename objects, or strings, so I just go for strings. For organization, I tried this:
def baseFiles(): dir('api') dir('settings') dir('core') file('main.py') file('events.txt') class mypackage(package): baseFiles()
which runs fine, but I get “:Packager: No files added to mypackage” and I imagine an empty package. Instead I need to put the code directly in mypackage, which seems to work, but I don’t see how it should be different.
Now I have:
from panda3d.core import Filename class mypackage(p3d): require('wx','morepy') dir('api') dir('settings') dir('core') dir('data') mainModule('main',filename=Filename('main.py')) file('events.txt')
Now for the really creepy thing: everytime I run ppackage with this pdef file, it deletes my main.py source file. Yes, ppackage deletes my main module source file (and I think/hope nothing else). I could add some code to my build script to copy and restore my main.py everytime, but that should not be needed. So, how to I make ppackage not delete my main module? (This really seems like a bug, and a really nasty one too)
Another question: is mainModule’s filename argument suppose to be able to take a string? Apparently it can’t, but I expected it to work. Also, in what case can you use mainModule without an explicit filename? I can’t make it work that way.