[Pythonmac-SIG] how do you determine if you're running a bundlebuilder standalone?

Bob Ippolito bob at redivi.com
Fri Aug 20 23:42:18 CEST 2004


On Aug 20, 2004, at 2:09 PM, Kevin Altis wrote:

> I have the following function for determining at runtime whether a 
> program is running standalone, but it needs to be updated for Mac OS X 
> and bundlebuilder.
>
> # Thomas Heller's function for determining
> # if a module is running standalone
> def main_is_frozen():
>     return (hasattr(sys, "importers") # py2exe
>             or imp.is_frozen("__main__") # cx_freeze or tools/freeze
>             or hasattr(sys, "frozen") # McMillan installer
>             )
>
> What's the magic attribute for bundlebuilder standalones?

bundlebuilder sets no such magic attribute to my knowledge.

 From PyObjC you can tell by looking at NSBundle.mainBundle().  
Depending on how the bundle is built, you might be able to tell by 
looking at sys.executable or sys.prefix.  Not sure.

py2app, when it's done, will behave more like py2exe in this regard.

-bob


More information about the Pythonmac-SIG mailing list