Ticket #3137 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

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

version_diff.patch Download (0.8 KB) - added by ChrisBarker 4 years ago.
patch to add version attribute to gdal.py

Change History

Changed 4 years ago by ChrisBarker

patch to add version attribute to gdal.py

Changed 4 years ago by hobu

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 1.7.0 to 1.6.3

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

Note: See TracTickets for help on using tickets.