[SciPy-dev] Automated get_version

Pearu Peterson pearu at cens.ioc.ee
Sat Jan 5 13:22:51 EST 2002


On Sat, 5 Jan 2002, Prabhu Ramachandran wrote:

> >>>>> "PP" == Pearu Peterson <pearu at cens.ioc.ee> writes:
>     PP> def get_version(release_level='alpha', path='.', major=None):
>     PP> """ Return version string calculated from CVS tree or found in
>     PP> <path>/__version__.py. Automatically update
>     PP> <path>/__version__.py if the version is changed.  An attempt
>     PP> is made to guarantee that version is increasing in time. This
>     PP> function always succeeds. None is returned if no version
>     PP> information is available.
> 
> Sorry for the dumb question but I'm afraid I really dont understand
> this too well.  Does get_version automatically change the version?  So
> if I were to rebuild the sources the version would increase?  If
> get_version changes the version maybe the name should be set_version
> and not get_version.  Or maybe you should have two separate functions
> for each.

get_version updates the version only after modified files are commited to
the CVS repository (as a result these files get new revision numbers). 
Building the sources or doing any other operations that does not change
the CVS revision numbers in CVS/Entries file(s) will _not_ alter the
version.

get_version is "get a version" in that sense that it returns the version
string from __version__.py file. But before that it checks that
__version__.py is up to date by calculating the version from the CVS
revision numbers.

May be update_version would be a better name because the purpose of this
function is neither to get or set the version, but to ensure that the
version numbers in __version__.py reflect the actual state of the CVS
repository. It is just convinient that it returns the version string that
can be used in the version keyword argument of the setup() function.

Pearu




More information about the SciPy-Dev mailing list