Opened 15 years ago

Closed 15 years ago

#3137 closed enhancement (fixed)

Add __version__ to python bindings

Reported by: ChrisBarker Owned by: hobu
Priority: normal Milestone: 1.6.3
Component: PythonBindings Version: unspecified
Severity: minor Keywords:
Cc:

Description

It's a pretty well supported convention now for Python modules to have a __version__ attribute that returns something meaningful. It would be nice if gdal.py had a line:

__version__ = VersionInfo("RELEASE_NAME")

or

__version__ = _gdal.VersionInfo("RELEASE_NAME")

While we're at it, it might be nice for osgeo\__init__.py to have a __version__ defined as well.

Patch attached -- I don't know if it's right for the osgeo\__init__.py to poke into gdal to get a version number, but I didn't know how else to do it. It also may not be the best idea to to import _gdal there, as someone using just OGR may not want it imported.

It may be best to have the setup.py or Makefile dump a version number into the __init__.py file at build time instead, but I'm not sure where it would come from.

I couldn't find any version info in OGR or OSR, so I haven't added anything for that.

Attachments (1)

version_diff.patch (790 bytes ) - added by ChrisBarker 15 years ago.
patch to add version attribute to gdal.py

Download all attachments as: .zip

Change History (2)

by ChrisBarker, 15 years ago

Attachment: version_diff.patch added

patch to add version attribute to gdal.py

comment:1 by hobu, 15 years ago

Milestone: 1.7.01.6.3
Resolution: fixed
Status: newclosed

Applied in trunk in r17634 and backported to the 1.6 branch in r17635

Note: See TracTickets for help on using tickets.