[python-mapnik] 01/01: Use upstream patch for boost library names fix.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Sun Aug 30 14:55:53 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 10aab557e7b3cf1bfb09bba2b5b6472fa96ee246
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sun Aug 30 16:15:59 2015 +0200

    Use upstream patch for boost library names fix.
---
 debian/changelog                                   |   6 +
 debian/patches/link-boost.patch                    |  18 ---
 debian/patches/series                              |   2 +-
 .../patches/try-to-guess-boost-library-names.patch | 154 +++++++++++++++++++++
 4 files changed, 161 insertions(+), 19 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9f991b4..25b12a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-mapnik (1:0.0~20150817-da1d9dd-2) UNRELEASED; urgency=medium
+
+  * Use upstream patch for boost library names fix.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Sun, 30 Aug 2015 16:11:33 +0200
+
 python-mapnik (1:0.0~20150817-da1d9dd-1) unstable; urgency=medium
 
   * New upstream Git snapshot.
diff --git a/debian/patches/link-boost.patch b/debian/patches/link-boost.patch
deleted file mode 100644
index 7671c73..0000000
--- a/debian/patches/link-boost.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Description: Fix boost library names.
-Author: Bas Couwenberg <sebastic at debian.org>
-
---- a/setup.py
-+++ b/setup.py
-@@ -48,9 +48,9 @@ else:
-     mapnik_config = 'mapnik-config'
-     mason_build = False
- 
--boost_python_lib = os.environ.get("BOOST_PYTHON_LIB", 'boost_python-mt')
--boost_system_lib = os.environ.get("BOOST_SYSTEM_LIB", 'boost_system-mt')
--boost_thread_lib = os.environ.get("BOOST_THREAD_LIB", 'boost_thread-mt')
-+boost_python_lib = os.environ.get("BOOST_PYTHON_LIB", 'boost_python')
-+boost_system_lib = os.environ.get("BOOST_SYSTEM_LIB", 'boost_system')
-+boost_thread_lib = os.environ.get("BOOST_THREAD_LIB", 'boost_thread')
- 
- try:
-     linkflags = check_output([mapnik_config, '--libs']).split(' ')
diff --git a/debian/patches/series b/debian/patches/series
index 9df6f28..739e28c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-link-boost.patch
+try-to-guess-boost-library-names.patch
diff --git a/debian/patches/try-to-guess-boost-library-names.patch b/debian/patches/try-to-guess-boost-library-names.patch
new file mode 100644
index 0000000..c66a3a5
--- /dev/null
+++ b/debian/patches/try-to-guess-boost-library-names.patch
@@ -0,0 +1,154 @@
+From 07c671f70e4fa16607e57510e38edc24559819f8 Mon Sep 17 00:00:00 2001
+From: Yohan Boniface <yb at enix.org>
+Date: Fri, 28 Aug 2015 13:10:51 +0200
+Subject: Try to guess boost library names (fix #12)
+Origin: https://github.com/yohanboniface/python-mapnik/commit/07c671f70e4fa16607e57510e38edc24559819f8
+
+---
+ setup.py | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 93 insertions(+), 8 deletions(-)
+
+--- a/setup.py
++++ b/setup.py
+@@ -1,13 +1,15 @@
+ #! /usr/bin/env python
+ 
+ import os
++import os.path
++import platform
+ import re
+ import shutil
+ import subprocess
+ import sys
+ from distutils import sysconfig
+ 
+-from setuptools import Extension, setup
++from setuptools import Command, Extension, setup
+ 
+ PYTHON3 = sys.version_info[0] == 3
+ 
+@@ -21,6 +23,92 @@ def check_output(args):
+     return output.rstrip('\n')
+ 
+ 
++def clean_boost_name(name):
++    name = name.split('.')[0]
++    if name.startswith('lib'):
++        name = name[3:]
++    return name
++
++
++def find_boost_library(_dir, _id):
++    if not os.path.exists(_dir):
++        return
++    for name in os.listdir(_dir):
++        if _id in name:
++            # Special case for boost_python, as it could contain python version
++            # number.
++            if "python" in _id:
++                if PYTHON3:
++                    if "3" not in name:
++                        continue
++                else:
++                    if "3" in name:
++                        continue
++            return clean_boost_name(name)
++
++
++def get_boost_library_names():
++    # A few examples:
++    # - Ubuntu 15.04 Multiarch or Debian sid:
++    #   /usr/lib/x86_64-linux-gnu/libboost_python.a -> libboost_python-py27.a
++    #   /usr/lib/x86_64-linux-gnu/libboost_python-py27.a
++    #   /usr/lib/x86_64-linux-gnu/libboost_python-py34.a
++    #   /usr/lib/x86_64-linux-gnu/libboost_system.a
++    #   /usr/lib/x86_64-linux-gnu/libboost_thread.a
++    # - Fedora 64 bits:
++    #   /usr/lib64/libboost_python.so
++    #   /usr/lib64/libboost_python3.so
++    #   /usr/lib64/libboost_system.so
++    #   /usr/lib64/libboost_thread.so
++    # - OSX with homebrew
++    #   /usr/local/lib/libboost_thread-mt.a -> ../Cellar/boost/1.57.0/lib/libboost_thread-mt.a  # noqa
++    # - Debian Wheezy
++    #   /usr/lib/libboost_python-py27.so
++    #   /usr/lib/libboost_python-mt-py27.so
++    names = {
++        "boost_python": os.environ.get("BOOST_PYTHON_LIB"),
++        "boost_system": os.environ.get("BOOST_SYSTEM_LIB"),
++        "boost_thread": os.environ.get("BOOST_THREAD_LIB")
++    }
++    if all(names.values()):
++        return names.values()
++    if os.name == 'posix':  # Unix system (Linux, MacOS)
++        libdirs = ['/lib', '/lib64', '/usr/lib', '/usr/lib64']
++        multiarch = sysconfig.get_config_var("MULTIARCH")
++        if multiarch:
++            libdirs.extend(['/lib/%s' % multiarch, '/usr/lib/%s' % multiarch])
++        if platform.system() == "Darwin":
++            libdirs.extend(['/opt/local/lib/'])
++        if os.environ.get('BOOST_ROOT'):
++            libdirs.append(os.environ.get('BOOST_ROOT'))
++        for _dir in libdirs:
++            for key, value in names.items():
++                if not value:
++                    value = find_boost_library(_dir, key)
++                    if value:
++                        names[key] = value
++            if all(names.values()):
++                break
++    for key, value in names.items():
++        if not value:
++            names[key] = key  # Set default.
++    return names.values()
++
++
++class WhichBoostCommand(Command):
++    description = 'Output found boost names. Useful for debug.'
++    user_options = []
++
++    def initialize_options(self):
++        pass
++
++    def finalize_options(self):
++        pass
++
++    def run(self):
++        print("\n".join(list(get_boost_library_names())))
++
++
+ cflags = sysconfig.get_config_var('CFLAGS')
+ sysconfig._config_vars['CFLAGS'] = re.sub(
+     ' +', ' ', cflags.replace('-g', '').replace('-Os', '').replace('-arch i386', ''))
+@@ -48,9 +136,6 @@ else:
+     mapnik_config = 'mapnik-config'
+     mason_build = False
+ 
+-boost_python_lib = os.environ.get("BOOST_PYTHON_LIB", 'boost_python-mt')
+-boost_system_lib = os.environ.get("BOOST_SYSTEM_LIB", 'boost_system-mt')
+-boost_thread_lib = os.environ.get("BOOST_THREAD_LIB", 'boost_thread-mt')
+ 
+ try:
+     linkflags = check_output([mapnik_config, '--libs']).split(' ')
+@@ -204,6 +289,9 @@ setup(
+         'mapnik': ['libmapnik.*', 'plugins/*/*'],
+     },
+     test_suite='nose.collector',
++    cmdclass={
++        'whichboost': WhichBoostCommand,
++    },
+     ext_modules=[
+         Extension('mapnik._mapnik', [
+             'src/mapnik_color.cpp',
+@@ -247,10 +335,7 @@ setup(
+                 'mapnik',
+                 'mapnik-wkt',
+                 'mapnik-json',
+-                boost_python_lib,
+-                boost_thread_lib,
+-                boost_system_lib
+-        ],
++            ] + list(get_boost_library_names()),
+             extra_compile_args=extra_comp_args,
+             extra_link_args=linkflags,
+         )

-- 
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