add mapnik_version_from_string helper function
This commit is contained in:
parent
7c5d0336c9
commit
3446a62265
2 changed files with 9 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue