[Distutils] Re: [ANN] pkgdata

Phillip J. Eby pje at telecommunity.com
Thu Mar 25 15:27:54 EST 2004


At 08:58 PM 3/25/04 +0100, Thomas Heller wrote:

>I had a probably related idea, to implement a function like 'is_frozen'
>or so, which would return whether a script is executed as standard
>python script, or run frozen in an executable (py2exe, Installer,
>freeze, cx_freeze).  This function should hide the exact details how
>this is determined, and be universally available.  This way modules
>needing to know this (for example the COM registration code in
>win32all^H^H^H^H^H^H^H^Hpywin32) could use this function to customize
>its behaviour, with relying on internal details of py2exe or Installer.

What I'm suggesting is that PEP 302 already provides a natural place for 
this to exist: the __loader__ method of a module.

The module itself, or other modules, can then access loader facilities via 
that object if it exists, or use a fallback if not.  And, if PEP 302 is 
ever "finished" (in the sense that the builtin Python import mechanism 
becomes part of the sys.metapath, then in theory we should also see a 
'__loader__' object available for normal modules.

Indeed, the only thing stopping this from happening, I believe, is that 
nobody's implemented it.  There's still probably a window in which it could 
be done for 2.4, and the  resulting standardization would be a blessing, 
especially if coupled with "package data" installation support in distutils.




More information about the Distutils-SIG mailing list