[python-mapnik] 01/03: Also build bindings for Python 3.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Thu Jul 16 21:34:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository python-mapnik.

commit d3d62b02fdbef6d4aa6b8af7996f051b95cce613
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Jul 16 19:06:19 2015 +0200

    Also build bindings for Python 3.
    
    Add patch to fix setup failure with Python 3.
---
 debian/control                     |  23 ++++++-
 debian/patches/python3-setup.patch | 132 +++++++++++++++++++++++++++++++++++++
 debian/patches/series              |   1 +
 debian/rules                       |   2 +-
 4 files changed, 156 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index 247b762..cf0d861 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,10 @@ Build-Depends: debhelper (>= 9),
                libmapnik-dev (>= 3.0.0+ds-2),
                python-all-dev,
                python-setuptools,
-               python-nose
+               python-nose,
+               python3-all-dev,
+               python3-setuptools,
+               python3-nose
 Standards-Version: 3.9.6
 Vcs-Browser: http://anonscm.debian.org/cgit/pkg-grass/python-mapnik.git
 Vcs-Git: git://anonscm.debian.org/pkg-grass/python-mapnik.git
@@ -34,3 +37,21 @@ Description: Python 2 interface to the mapnik library
  .
  This package contains the bindings for Python 2.
 
+Package: python3-mapnik
+Architecture: any
+Depends: ${python3:Depends},
+         ${shlibs:Depends},
+         ${misc:Depends}
+Provides: ${python3:Provides}
+Description: Python 3 interface to the mapnik library
+ Mapnik is an OpenSource C++ toolkit for developing GIS
+ (Geographic Information Systems) applications. At the core is a C++
+ shared library providing algorithms/patterns for spatial data access and
+ visualization.
+ .
+ Essentially a collection of geographic objects (map, layer, datasource,
+ feature, geometry), the library doesn't rely on "windowing systems" and
+ is intended to work in multi-threaded environments
+ .
+ This package contains the bindings for Python 3.
+
diff --git a/debian/patches/python3-setup.patch b/debian/patches/python3-setup.patch
new file mode 100644
index 0000000..9ead7c5
--- /dev/null
+++ b/debian/patches/python3-setup.patch
@@ -0,0 +1,132 @@
+Description: Fix setup failure with Python 3.
+ Example failures:
+ .
+  I: pybuild base:170: python3.4 setup.py config
+  Traceback (most recent call last):
+    File "setup.py", line 38, in <module>
+      linkflags = subprocess.check_output([mapnik_config, '--libs']).rstrip('\n').split(' ')
+  TypeError: 'str' does not support the buffer interface
+ .
+  I: pybuild base:170: python3.4 setup.py config
+  Traceback (most recent call last):
+    File "setup.py", line 156, in <module>
+      os.environ["CC"] = subprocess.check_output([mapnik_config, '--cxx']).rstrip(b'\n')
+    File "/usr/lib/python3.4/os.py", line 638, in __setitem__
+      value = self.encodevalue(value)
+    File "/usr/lib/python3.4/os.py", line 706, in encode
+      raise TypeError("str expected, not %s" % type(value).__name__)
+  TypeError: str expected, not bytes
+ .
+  Traceback (most recent call last):
+    File "setup.py", line 225, in <module>
+      extra_link_args = linkflags,
+    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
+      dist.run_commands()
+    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
+      self.run_command(cmd)
+    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
+      cmd_obj.run()
+    File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
+      self.run_command(cmd_name)
+    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
+      self.distribution.run_command(command)
+    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
+      cmd_obj.run()
+    File "/usr/lib/python2.7/dist-packages/setuptools/command/build_ext.py", line 50, in run
+      _build_ext.run(self)
+    File "/usr/lib/python2.7/distutils/command/build_ext.py", line 337, in run
+      self.build_extensions()
+    File "/usr/lib/python2.7/distutils/command/build_ext.py", line 446, in build_extensions
+      self.build_extension(ext)
+    File "/usr/lib/python2.7/dist-packages/setuptools/command/build_ext.py", line 183, in build_extension
+      _build_ext.build_extension(self, ext)
+    File "/usr/lib/python2.7/distutils/command/build_ext.py", line 496, in build_extension
+      depends=ext.depends)
+    File "/usr/lib/python2.7/distutils/ccompiler.py", line 574, in compile
+      self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
+    File "/usr/lib/python2.7/distutils/unixccompiler.py", line 119, in _compile
+      self.spawn(compiler_so + cc_args + [src, '-o', obj] +
+  TypeError: coercing to Unicode: need string or buffer, list found
+ .
+Author: Bas Couwenberg <sebastic at debian.org>
+
+--- a/setup.py
++++ b/setup.py
+@@ -35,9 +35,9 @@ boost_system_lib = os.environ.get("BOOST
+ boost_thread_lib = os.environ.get("BOOST_THREAD_LIB", 'boost_thread')
+ 
+ try:
+-    linkflags = subprocess.check_output([mapnik_config, '--libs']).rstrip('\n').split(' ')
++    linkflags = subprocess.check_output([mapnik_config, '--libs']).rstrip(b'\n').split(b' ')
+     lib_path = linkflags[0][2:]
+-    linkflags.extend(subprocess.check_output([mapnik_config, '--ldflags']).rstrip('\n').split(' '))
++    linkflags.extend(subprocess.check_output([mapnik_config, '--ldflags']).rstrip(b'\n').split(b' '))
+ except:
+     raise Exception("Failed to find proper linking flags from mapnik config");
+ 
+@@ -60,7 +60,7 @@ if mason_build:
+         shutil.copyfile(f, os.path.join('mapnik', base_f))
+     except shutil.Error:
+         pass
+-    input_plugin_path = subprocess.check_output([mapnik_config, '--input-plugins']).rstrip('\n')
++    input_plugin_path = subprocess.check_output([mapnik_config, '--input-plugins']).rstrip(b'\n')
+     input_plugin_files = os.listdir(input_plugin_path)
+     input_plugin_files = [os.path.join(input_plugin_path, f) for f in input_plugin_files]
+     if not os.path.exists(os.path.join('mapnik','plugins','input')):
+@@ -70,7 +70,7 @@ if mason_build:
+             shutil.copyfile(f, os.path.join('mapnik', 'plugins', 'input', os.path.basename(f)))
+         except shutil.Error:
+             pass
+-    font_path = subprocess.check_output([mapnik_config, '--fonts']).rstrip('\n')
++    font_path = subprocess.check_output([mapnik_config, '--fonts']).rstrip(b'\n')
+     font_files = os.listdir(font_path)
+     font_files = [os.path.join(font_path, f) for f in font_files]
+     if not os.path.exists(os.path.join('mapnik','plugins','fonts')):
+@@ -94,7 +94,7 @@ if create_paths:
+ 
+ 
+ if not mason_build:
+-    icu_path = subprocess.check_output([mapnik_config, '--icu-data']).rstrip('\n')
++    icu_path = subprocess.check_output([mapnik_config, '--icu-data']).rstrip(b'\n')
+ else:
+     icu_path = 'mason_packages/.link/share/icu/'
+ if icu_path:
+@@ -109,7 +109,7 @@ if icu_path:
+             pass
+ 
+ if not mason_build:
+-    gdal_path = subprocess.check_output([mapnik_config, '--gdal-data']).rstrip('\n')
++    gdal_path = subprocess.check_output([mapnik_config, '--gdal-data']).rstrip(b'\n')
+ else:
+     gdal_path = 'mason_packages/.link/share/gdal/'
+     if os.path.exists('mason_packages/.link/share/gdal/gdal/'):
+@@ -126,7 +126,7 @@ if gdal_path:
+             pass
+ 
+ if not mason_build:
+-    proj_path = subprocess.check_output([mapnik_config, '--proj-lib']).rstrip('\n')
++    proj_path = subprocess.check_output([mapnik_config, '--proj-lib']).rstrip(b'\n')
+ else:
+     proj_path = 'mason_packages/.link/share/proj/'
+     if os.path.exists('mason_packages/.link/share/proj/proj/'):
+@@ -142,7 +142,7 @@ if proj_path:
+         except shutil.Error:
+             pass
+ 
+-extra_comp_args = subprocess.check_output([mapnik_config, '--cflags']).rstrip('\n').split(' ')
++extra_comp_args = subprocess.check_output([mapnik_config, '--cflags']).rstrip(b'\n').split(b' ')
+ 
+ if sys.platform == 'darwin':
+     extra_comp_args.append('-mmacosx-version-min=10.8')
+@@ -153,9 +153,9 @@ else:
+     linkflags.append('-Wl,-rpath=$ORIGIN')
+ 
+ if os.environ.get("CC",False) == False:
+-    os.environ["CC"] = subprocess.check_output([mapnik_config, '--cxx']).rstrip('\n')
++    os.environ["CC"] = subprocess.check_output([mapnik_config, '--cxx']).rstrip(b'\n').decode("utf-8")
+ if os.environ.get("CXX",False) == False:
+-    os.environ["CXX"] = subprocess.check_output([mapnik_config, '--cxx']).rstrip('\n')
++    os.environ["CXX"] = subprocess.check_output([mapnik_config, '--cxx']).rstrip(b'\n').decode("utf-8")
+ 
+ setup(
+     name = "mapnik",
diff --git a/debian/patches/series b/debian/patches/series
index 9df6f28..8389ae7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 link-boost.patch
+python3-setup.patch
diff --git a/debian/rules b/debian/rules
index 9f96e6a..8f6d403 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,7 +8,7 @@ export PYBUILD_NAME=mapnik
 
 %:
 	dh $@ \
-		--with python2 \
+		--with python2,python3 \
 		--buildsystem=pybuild \
 		--parallel
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/python-mapnik.git



More information about the Pkg-grass-devel mailing list