diff --git a/CHANGELOG b/CHANGELOG index a4e572745..8b59e5e02 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,9 @@ For a complete change history, see the SVN log. Mapnik Trunk ------------ +- Added 'mapnik_version_from_string()' function in python bindings to easily convert string representation + of version number to the integer format used in 'mapnik/version.hpp'. e.g. '0.7.1' --> 701. + - Added xinclude (http://www.w3.org/TR/xinclude/) support to libxml2-based xml parser (oldtopos) (#567) - Optimized rendering speeds by avoiding locking in the projection code (r2063) diff --git a/bindings/python/mapnik/__init__.py b/bindings/python/mapnik/__init__.py index 175292769..6ba850e70 100644 --- a/bindings/python/mapnik/__init__.py +++ b/bindings/python/mapnik/__init__.py @@ -601,14 +601,18 @@ def Kismet(**keywords): keywords['type'] = 'kismet' return CreateDatasource(keywords) -def mapnik_version_string(): +def mapnik_version_string(version=mapnik_version()): """Return the Mapnik version as a string.""" - version = mapnik_version() patch_level = version % 100 minor_version = version / 100 % 1000 major_version = version / 100000 return '%s.%s.%s' % ( major_version, minor_version,patch_level) +def mapnik_version_from_string(version_string): + """Return the Mapnik version from a string.""" + n = version_string.split('.') + return (int(n[0]) * 100000) + (int(n[1]) * 100) + (int(n[2])); + def register_plugins(path=inputpluginspath): """Register plugins located by specified path""" DatasourceCache.instance().register_datasources(path)