maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Maposmatic-dev] [PATCH] [v2][ocitysmap] Mapnik 2+: update INSTALL a


From: Maxime Petazzoni
Subject: Re: [Maposmatic-dev] [PATCH] [v2][ocitysmap] Mapnik 2+: update INSTALL and get rid of DeprecationWarning
Date: Wed, 4 Apr 2012 11:32:33 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

* Jeroen van Rijn <address@hidden> [2012-04-04 15:15:25]:

> -    b. Download Mapnik
> +    b. Download the latest Mapnik from its Git repository
>  
> -    wget http://download.berlios.de/mapnik/mapnik-2.0.0.tar.bz2
> +    git clone git://github.com/mapnik/mapnik.git
>  
> -    c. Compile and install Mapnik 2
> +    This implicitly runs 'git checkout HEAD', giving you the latest version.
> +    Should you run into trouble either installing or running this latest 
> version,
> +    you can use the version we know to work:
>  
> -    tar xvjf mapnik-2.0.0.tar.bz2
> -    cd mapnik-2.0.0
> +    git checkout c88fcc8f046138fb9fb73bdb42dfed1e9c4b86cd # dated Tue Apr 3

This must be run inside the git repository, so `cd mapnik` should be
done beforehand.

>  
> -    (any version >= 2.0.0 should follow the same scheme)
> +    c. Compile and install Mapnik
> +
> +    cd mapnik
>  
>      python scons/scons.py configure INPUT_PLUGINS=all \
>        OPTIMIZATION=3 SYSTEM_FONTS=/usr/share/fonts/
> @@ -189,7 +192,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..5d023a7 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 DeprecationWarning as of mapnik
> +# commit 14700dba16146902ca98fdcacb72b2fba4fa596a
> +# As mapnik 2.1 (or git version with support for placement-type="simple")
> +# 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, 
> see ocitysmap's INSTALL for more details." \
> +                                        % mapnik.mapnik_version_string()

Can we wrap this a bit better? Also, you might want to use abbreviated
commit IDs for readability (same remark in the INSTALL file above).

> +import mapnik

No assert here?

>  import pango
>  import re
>  
> diff --git a/ocitysmap2/layoutlib/multi_page_renderer.py 
> b/ocitysmap2/layoutlib/multi_page_renderer.py
> index e41af24..71d3b75 100644
> --- a/ocitysmap2/layoutlib/multi_page_renderer.py
> +++ b/ocitysmap2/layoutlib/multi_page_renderer.py
> @@ -25,10 +25,7 @@ import tempfile
>  import math
>  import sys
>  import cairo
> -try:
> -    import mapnik2 as mapnik
> -except ImportError:
> -    import mapnik
> +import mapnik

Ditto?

>  import coords
>  import locale
>  import pangocairo
> diff --git a/ocitysmap2/layoutlib/single_page_renderers.py 
> b/ocitysmap2/layoutlib/single_page_renderers.py
> index 172f8bf..c775d16 100644
> --- a/ocitysmap2/layoutlib/single_page_renderers.py
> +++ b/ocitysmap2/layoutlib/single_page_renderers.py
> @@ -26,10 +26,7 @@ import math
>  import datetime
>  import cairo
>  import locale
> -try:
> -    import mapnik2 as mapnik
> -except ImportError:
> -    import mapnik
> +import mapnik

Ditto?

>  import pango
>  import pangocairo
>  
> diff --git a/ocitysmap2/maplib/map_canvas.py b/ocitysmap2/maplib/map_canvas.py
> index 444a5ff..9e440cd 100644
> --- a/ocitysmap2/maplib/map_canvas.py
> +++ b/ocitysmap2/maplib/map_canvas.py
> @@ -23,10 +23,16 @@
>  # 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 DeprecationWarning as of mapnik
> +# commit 14700dba16146902ca98fdcacb72b2fba4fa596a
> +# As mapnik 2.1 (or git version with support for placement-type="simple")
> +# 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, 
> see ocitysmap's INSTALL for more details." \
> +                                        % mapnik.mapnik_version_string()
> +

And you did it here though. This should be consistent IMHO.

/Max
-- 
Maxime Petazzoni <http://www.bulix.org>
 ``One by one, the penguins took away my sanity.''
Writing software in California

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]