[bfprog] Packaging and Importing Custom Python Code

Forrest Thiessen thiessen at cyberscapearena.com
Wed Jun 22 09:09:59 PDT 2005


Anton Jansen wrote:

> This is indeed the kind of stuff I had in mind. Currently, I don't
> have much time, I hope to spend some time in the weekend on this. 
> Couple of remarks:
>
> 1. Make subdirectories for each server side mods, this prevents
> filename collisions
> 2. Make a python scripts which checks and adds if need the necessary
> line into the BF2 file (ease deployment)
> 3. Status functions for the metamod are needed, like which mods are
> loaded atm, unload function etc.
>
> P.S.
> Could you respond to my requirements list post and see wheter we agree
> on this? 

Hi, Anton!  Sorry, I didn't see a requirements list posting--could you
repost it?

As for the items on your list:

1. Should be easy--I think there's an existing API call that tells you
what mod is in use.  I'll check.  One thing that might cause difficulty
would be that, unless you take special steps to force it, Python only
imports any module (including this "custom" module) once, even if you
ask for it to be imported multiple times.  The question is: if you have
the server change mods, does it "restart" the Python interpreter, so
that the custom module would run again, and thus be able to import
customized code for the new mod?  Hmmm. . . .
2. Great idea!  I'll give some thought to how to do it. Probably best be
done as a separate installer program.
3. I'll think about that one--the existing mechanisms in Python for
checking which modules have been imported might be sufficient; if not,
it should be easy to add a wrapper around them that filters out
everything except "custom" modules.

--Forrest



More information about the BFProg mailing list