pre-processing source from distutils

Michael Stenner mstenner at
Mon Mar 15 17:07:45 CET 2004

Michael Stenner wrote:
> Is it possible to pre-process source code from distutils?  I don't want 
> to do anything too fancy.  I just want to put the VERSION from 
> (and maybe a date) into the module at sdist or build time (I haven't 
> decided which of those would be cleaner).  Anybody know of a clean way 
> to do this?

After some hunting around, I found that the preferred way to handle this 
specific problem is to put __version__ = 'x.x.x' in the module itself 
(or in for a package) and then have import the 
module and slurp the version in from there.  That works for me.


More information about the Python-list mailing list