[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get r
From: |
Jeroen van Rijn |
Subject: |
[Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning |
Date: |
Wed, 4 Apr 2012 12:55:30 +0200 |
As of mapnik commit 14700dba16146902ca98fdcacb72b2fba4fa596a,
using 'import mapnik2' raises a DeprecationWarning.
See https://github.com/mapnik/mapnik/issues/941 for details.
Update imports of the mapnik module to use 'import mapnik' and assert
that the installed version is new enough.
Tested-by: Jeroen van Rijn <address@hidden>
Signed-off-by: Jeroen van Rijn <address@hidden>
---
INSTALL | 12 ++++++++----
ocitysmap2/coords.py | 13 +++++++++----
ocitysmap2/layoutlib/abstract_renderer.py | 14 ++++++++++----
ocitysmap2/layoutlib/multi_page_renderer.py | 14 ++++++++++----
ocitysmap2/layoutlib/single_page_renderers.py | 14 ++++++++++----
ocitysmap2/maplib/map_canvas.py | 13 +++++++++----
6 files changed, 56 insertions(+), 24 deletions(-)
diff --git a/INSTALL b/INSTALL
index c82157e..21875e2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -166,14 +166,18 @@ are using. They have been tested on several x86_64 hosts.
libboost-regex1.46-dev libboost-serialization1.46-dev \
libboost-system1.46-dev libboost-thread1.46-dev
- b. Download Mapnik
+ b. Download and unpack Mapnik
wget http://download.berlios.de/mapnik/mapnik-2.0.0.tar.bz2
+ tar xvjf mapnik-2.0.0.tar.bz2
+
+ alternatively, grab the latest version:
+
+ git clone https://github.com/mapnik/mapnik.git
c. Compile and install Mapnik 2
- tar xvjf mapnik-2.0.0.tar.bz2
- cd mapnik-2.0.0
+ cd mapnik-2.0.0 # or mapnik if you grabbed the git repository
(any version >= 2.0.0 should follow the same scheme)
@@ -189,7 +193,7 @@ are using. They have been tested on several x86_64 hosts.
d. Check the installation
- Run a Python interpreter, and run "import mapnik2". If it doesn't
+ Run a Python interpreter, and run "import mapnik". If it doesn't
work and you didn't do a system-wide installation of Mapnik, don't
forget to set the PYTHONPATH and LD_LIBRARY_PATH environment
variables.
diff --git a/ocitysmap2/coords.py b/ocitysmap2/coords.py
index 3050c71..50109d9 100644
--- a/ocitysmap2/coords.py
+++ b/ocitysmap2/coords.py
@@ -25,10 +25,15 @@
import math
import shapely.wkt
-try:
- import mapnik2 as mapnik
-except ImportError:
- import mapnik
+
+# Importing mapnik2 raises a DeprectionWarning as of mapnik
+# commit 14700dba16146902ca98fdcacb72b2fba4fa596a
+# As mapnik 2 is required for OCitySMap (see INSTALL), instead
+# of importing mapnik2, we import mapnik and assert it isn't
+# an old version.
+import mapnik
+assert mapnik.mapnik_version >= 200000, "Mapnik module version %s too old." \
+ % mapnik.mapnik_version_string()
_MAPNIK_PROJECTION = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 " \
"+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m " \
diff --git a/ocitysmap2/layoutlib/abstract_renderer.py
b/ocitysmap2/layoutlib/abstract_renderer.py
index 5517ab9..10a89cb 100644
--- a/ocitysmap2/layoutlib/abstract_renderer.py
+++ b/ocitysmap2/layoutlib/abstract_renderer.py
@@ -27,10 +27,16 @@ import math
import os
import sys
import cairo
-try:
- import mapnik2 as mapnik
-except ImportError:
- import mapnik
+
+# Importing mapnik2 raises a DeprectionWarning as of mapnik
+# commit 14700dba16146902ca98fdcacb72b2fba4fa596a
+# As mapnik 2 is required for OCitySMap (see INSTALL), instead
+# of importing mapnik2, we import mapnik and assert it isn't
+# an old version.
+import mapnik
+assert mapnik.mapnik_version >= 200000, "Mapnik module version %s too old." \
+ % mapnik.mapnik_version_string()
+
import pango
import re
diff --git a/ocitysmap2/layoutlib/multi_page_renderer.py
b/ocitysmap2/layoutlib/multi_page_renderer.py
index e41af24..99ddc2c 100644
--- a/ocitysmap2/layoutlib/multi_page_renderer.py
+++ b/ocitysmap2/layoutlib/multi_page_renderer.py
@@ -25,10 +25,16 @@ import tempfile
import math
import sys
import cairo
-try:
- import mapnik2 as mapnik
-except ImportError:
- import mapnik
+
+# Importing mapnik2 raises a DeprectionWarning as of mapnik
+# commit 14700dba16146902ca98fdcacb72b2fba4fa596a
+# As mapnik 2 is required for OCitySMap (see INSTALL), instead
+# of importing mapnik2, we import mapnik and assert it isn't
+# an old version.
+import mapnik
+assert mapnik.mapnik_version >= 200000, "Mapnik module version %s too old." \
+ % mapnik.mapnik_version_string()
+
import coords
import locale
import pangocairo
diff --git a/ocitysmap2/layoutlib/single_page_renderers.py
b/ocitysmap2/layoutlib/single_page_renderers.py
index 172f8bf..2bd4675 100644
--- a/ocitysmap2/layoutlib/single_page_renderers.py
+++ b/ocitysmap2/layoutlib/single_page_renderers.py
@@ -26,10 +26,16 @@ import math
import datetime
import cairo
import locale
-try:
- import mapnik2 as mapnik
-except ImportError:
- import mapnik
+
+# Importing mapnik2 raises a DeprectionWarning as of mapnik
+# commit 14700dba16146902ca98fdcacb72b2fba4fa596a
+# As mapnik 2 is required for OCitySMap (see INSTALL), instead
+# of importing mapnik2, we import mapnik and assert it isn't
+# an old version.
+import mapnik
+assert mapnik.mapnik_version >= 200000, "Mapnik module version %s too old." \
+ % mapnik.mapnik_version_string()
+
import pango
import pangocairo
diff --git a/ocitysmap2/maplib/map_canvas.py b/ocitysmap2/maplib/map_canvas.py
index 444a5ff..d0a1772 100644
--- a/ocitysmap2/maplib/map_canvas.py
+++ b/ocitysmap2/maplib/map_canvas.py
@@ -23,10 +23,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
-try:
- import mapnik2 as mapnik
-except ImportError:
- import mapnik
+# Importing mapnik2 raises a DeprectionWarning as of mapnik
+# commit 14700dba16146902ca98fdcacb72b2fba4fa596a
+# As mapnik 2 is required for OCitySMap (see INSTALL), instead
+# of importing mapnik2, we import mapnik and assert it isn't
+# an old version.
+import mapnik
+assert mapnik.mapnik_version >= 200000, "Mapnik module version %s too old." \
+ % mapnik.mapnik_version_string()
+
import os
from ocitysmap2 import coords
--
1.7.10.rc1.22.gf5241
- [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning,
Jeroen van Rijn <=
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, Thomas Petazzoni, 2012/04/04
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, Jeroen van Rijn, 2012/04/04
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, David MENTRE, 2012/04/04
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, Thomas Petazzoni, 2012/04/04
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, Jeroen van Rijn, 2012/04/04
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, David MENTRE, 2012/04/04
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, Jeroen van Rijn, 2012/04/04
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, David MENTRE, 2012/04/04
- Re: [Maposmatic-dev] [PATCH] [ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning, Jeroen van Rijn, 2012/04/04