osx: add pycairo wrapper script and rename mapnik one
This commit is contained in:
parent
bdc184c686
commit
e5f2a76110
2 changed files with 17 additions and 0 deletions
17
osx/python/cairo.py
Normal file
17
osx/python/cairo.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import sys
|
||||
|
||||
ver_int = int('%s%s' % (sys.version_info[0],sys.version_info[1]))
|
||||
ver_str = '%s.%s' % (sys.version_info[0],sys.version_info[1])
|
||||
|
||||
path_insert = '/Library/Frameworks/Mapnik.framework/Versions/2.0/unix/lib/python%s/site-packages/'
|
||||
|
||||
if ver_int < 26:
|
||||
raise ImportError('Cairo bindings are only available for python versions >= 2.6')
|
||||
elif ver_int in (26,27,31):
|
||||
sys.path.insert(0, path_insert % ver_str)
|
||||
from cairo import *
|
||||
elif ver_int > 31:
|
||||
raise ImportError('Cairo bindings are only available for python versions <= 3.1')
|
||||
else:
|
||||
raise ImportError('Cairo bindings are only available for python versions 2.6, 2.7, and 3.1')
|
||||
|
Loading…
Reference in a new issue