tag 566790 + patch
thanks

Hello,

support for building the Python binding was done by us because be needed
tre for some Python project. The source file needs to be patched because
the Python binding as is expects the tre shared object library already
to be installed when building the binding. Since this is not the case
with Debians build system, change the run time paths to build time
paths.

Since our distrubution is still Squeeze based, so this is a forward port
to Wheezy/Sid. Please have a look at the patch before blindly applying
it, because I don't know if any special Multiarch handling is needed.

Sincerely
Philipp
-- 
Philipp Hahn           Open Source Software Engineer      h...@univention.de
Univention GmbH        be open.                       fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen                 fax: +49 421 22 232-99
                                                   http://www.univention.de/
diff -urN '--exclude=.pc' tre-0.8.0.debian/debian/control tre-0.8.0.ucs/debian/control
--- tre-0.8.0.debian/debian/control	2012-06-03 17:23:32.000000000 +0200
+++ tre-0.8.0.ucs/debian/control	2012-07-11 18:35:51.000000000 +0200
@@ -4,7 +4,7 @@
 Maintainer: Santiago Vila <sanv...@debian.org>
 Uploaders: Milan Zamazal <p...@debian.org>
 Standards-Version: 3.9.2
-Build-Depends: gettext (>= 0.18.1.1-8), debhelper (>= 9)
+Build-Depends: gettext (>= 0.18.1.1-8), debhelper (>= 9), python-all-dev (>= 2.6.6-3~)
 
 Package: libtre5
 Architecture: any
@@ -34,3 +34,12 @@
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: approximate grep utility based on the tre library
  This is an Approximate GREP utility based on the TRE regexp matching library
+
+Package: python-libtre
+Architecture: any
+Section: python
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Python binding for the tre library
+ This is an Approximate GREP utility based on the TRE regexp matching library
+ .
+ This package contains Python bindings for the libtre library
diff -urN '--exclude=.pc' tre-0.8.0.debian/debian/patches/03-build-python-binding tre-0.8.0.ucs/debian/patches/03-build-python-binding
--- tre-0.8.0.debian/debian/patches/03-build-python-binding	1970-01-01 01:00:00.000000000 +0100
+++ tre-0.8.0.ucs/debian/patches/03-build-python-binding	2012-07-11 18:35:51.000000000 +0200
@@ -0,0 +1,30 @@
+Description: Build python binding
+ Build the binding during package build requires some (hackish) path name changes.
+Origin: vendor
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Univention: <https://forge.univention.org/bugzilla/show_bug.cgi?id=17290>
+Forwarded: no
+Author: Philipp Hahn <h...@univention.de>
+Last-Update: 2012-07-06
+
+--- tre-0.8.0.orig/python/setup.py
++++ tre-0.8.0/python/setup.py
+@@ -31,6 +31,7 @@ setup(name = "tre",
+                                sources = ["tre-python.c"],
+                                define_macros = [("HAVE_CONFIG_H", None)],
+                                include_dirs = include_dirs,
++                               library_dirs = ['../lib/.libs'],
+                                libraries = libraries
+                                ),
+                      ],
+--- tre-0.8.0.orig/python/tre-python.c
++++ tre-0.8.0/python/tre-python.c
+@@ -13,7 +13,7 @@
+ #include "Python.h"
+ #include "structmember.h"
+ 
+-#include <tre/tre.h>
++#include "../lib/tre.h"
+ 
+ #define	TRE_MODULE	"tre"
+ 
diff -urN '--exclude=.pc' tre-0.8.0.debian/debian/patches/series tre-0.8.0.ucs/debian/patches/series
--- tre-0.8.0.debian/debian/patches/series	2011-08-07 12:01:00.000000000 +0200
+++ tre-0.8.0.ucs/debian/patches/series	2012-07-11 18:35:51.000000000 +0200
@@ -1,3 +1,4 @@
 01-agrep-is-called-tre-agrep-here
 02-added-de-po-translation
+03-build-python-binding
 99-config-guess-config-sub
diff -urN '--exclude=.pc' tre-0.8.0.debian/debian/python-libtre.install tre-0.8.0.ucs/debian/python-libtre.install
--- tre-0.8.0.debian/debian/python-libtre.install	1970-01-01 01:00:00.000000000 +0100
+++ tre-0.8.0.ucs/debian/python-libtre.install	2012-07-11 18:35:51.000000000 +0200
@@ -0,0 +1 @@
+usr/lib/python*
diff -urN '--exclude=.pc' tre-0.8.0.debian/debian/rules tre-0.8.0.ucs/debian/rules
--- tre-0.8.0.debian/debian/rules	2012-06-03 17:44:24.000000000 +0200
+++ tre-0.8.0.ucs/debian/rules	2012-07-11 18:35:51.000000000 +0200
@@ -1,6 +1,10 @@
 #!/usr/bin/make -f
 %:
-	dh $@
+	dh $@ --with python2
+
+override_dh_auto_clean:
+	dh_auto_clean
+	dh_auto_clean --sourcedirectory=python --buildsystem python_distutils
 
 override_dh_clean:
 	dh_clean
@@ -10,13 +14,16 @@
 
 override_dh_auto_configure:
 	dh_auto_configure -- --enable-static
+	dh_auto_configure --sourcedirectory=python --buildsystem python_distutils
 
 override_dh_auto_build:
 	dh_auto_build
+	dh_auto_build --sourcedirectory=python --buildsystem python_distutils
 	$(MAKE) -C po update-gmo
 
 override_dh_auto_install:
 	dh_auto_install
+	dh_auto_install --sourcedirectory=python --buildsystem python_distutils
 	mv debian/tmp/usr/bin/agrep \
 	   debian/tmp/usr/bin/tre-agrep
 	mv debian/tmp/usr/share/man/man1/agrep.1 \
diff -urN '--exclude=.pc' tre-0.8.0.debian/python/setup.py tre-0.8.0.ucs/python/setup.py
--- tre-0.8.0.debian/python/setup.py	2009-09-20 09:51:01.000000000 +0200
+++ tre-0.8.0.ucs/python/setup.py	2012-09-12 10:33:02.000000000 +0200
@@ -31,6 +31,7 @@
                                sources = ["tre-python.c"],
                                define_macros = [("HAVE_CONFIG_H", None)],
                                include_dirs = include_dirs,
+                               library_dirs = ['../lib/.libs'],
                                libraries = libraries
                                ),
                      ],
diff -urN '--exclude=.pc' tre-0.8.0.debian/python/tre-python.c tre-0.8.0.ucs/python/tre-python.c
--- tre-0.8.0.debian/python/tre-python.c	2009-09-19 16:38:42.000000000 +0200
+++ tre-0.8.0.ucs/python/tre-python.c	2012-09-12 10:33:02.000000000 +0200
@@ -13,7 +13,7 @@
 #include "Python.h"
 #include "structmember.h"
 
-#include <tre/tre.h>
+#include "../lib/tre.h"
 
 #define	TRE_MODULE	"tre"
 

Reply via email to