[ffc] 01/01: python3-only: use alternatives for ufc.h
Drew Parsons
dparsons at moszumanska.debian.org
Thu Jun 8 04:55:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
dparsons pushed a commit to branch master
in repository ffc.
commit eadd8f6c145d9a7f4561a267ef74389401212c16
Author: Drew Parsons <dparsons at debian.org>
Date: Thu Jun 8 11:57:15 2017 +0800
python3-only: use alternatives for ufc.h
Enable python3-only installations by using alternatives for
/usr/include/ufc.h (provided by either python-ffc or python3-ffc).
ufc.h is used by libdolfin-dev.
---
debian/changelog | 8 ++++++++
debian/python-ffc.postinst | 11 +++++++++++
debian/python-ffc.prerm | 10 ++++++++++
debian/python3-ffc.postinst | 11 +++++++++++
debian/python3-ffc.prerm | 10 ++++++++++
debian/rules | 15 +++++++++++++++
6 files changed, 65 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 347cc49..a7f18ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ffc (2016.2.0-4) UNRELEASED; urgency=medium
+
+ * Enable python3-only installations by using alternatives for
+ /usr/include/ufc.h (provided by either python-ffc or python3-ffc).
+ ufc.h is used by libdolfin-dev.
+
+ -- Drew Parsons <dparsons at debian.org> Thu, 08 Jun 2017 11:54:31 +0800
+
ffc (2016.2.0-3) unstable; urgency=medium
* d/patches/fix-float-division.patch: Add patch to fix float division
diff --git a/debian/python-ffc.postinst b/debian/python-ffc.postinst
new file mode 100644
index 0000000..8f215cd
--- /dev/null
+++ b/debian/python-ffc.postinst
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+
+UFC_INCLUDE_DIR=__PYTHON_UFC_DIR__
+
+# Make alternatives links
+if [ "$1" = "configure" ]; then
+ # alternative ufc.h
+ update-alternatives --install /usr/include/ufc.h ufc.h ${UFC_INCLUDE_DIR}/ufc.h 100
+fi
+
+#DEBHELPER#
diff --git a/debian/python-ffc.prerm b/debian/python-ffc.prerm
new file mode 100644
index 0000000..88ae2ed
--- /dev/null
+++ b/debian/python-ffc.prerm
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+UFC_INCLUDE_DIR=__PYTHON_UFC_DIR__
+
+# Remove alternatives links
+if [ "$1" = "remove" ]; then
+ update-alternatives --remove ufc.h ${UFC_INCLUDE_DIR}/ufc.h
+fi
+
+#DEBHELPER#
diff --git a/debian/python3-ffc.postinst b/debian/python3-ffc.postinst
new file mode 100644
index 0000000..08f036d
--- /dev/null
+++ b/debian/python3-ffc.postinst
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+
+UFC_INCLUDE_DIR=__PYTHON3_UFC_DIR__
+
+# Make alternatives links
+if [ "$1" = "configure" ]; then
+ # alternative ufc.h
+ update-alternatives --install /usr/include/ufc.h ufc.h ${UFC_INCLUDE_DIR}/ufc.h 100
+fi
+
+#DEBHELPER#
diff --git a/debian/python3-ffc.prerm b/debian/python3-ffc.prerm
new file mode 100644
index 0000000..f087cf0
--- /dev/null
+++ b/debian/python3-ffc.prerm
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+UFC_INCLUDE_DIR=__PYTHON3_UFC_DIR__
+
+# Remove alternatives links
+if [ "$1" = "remove" ]; then
+ update-alternatives --remove ufc.h ${UFC_INCLUDE_DIR}/ufc.h
+fi
+
+#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index aa4710f..fc211fa 100755
--- a/debian/rules
+++ b/debian/rules
@@ -20,6 +20,14 @@ FENICS_NEXT_VERSION=$(FENICS_MAJOR_VERSION).$(shell echo $$(( $(FENICS_MINOR_VER
USCAN_DESTDIR := $(CURDIR)
+PYTHON_BASE_SCRIPT="import sys; base=list(filter( lambda p: p.startswith('/usr/lib/python') and p.endswith('/dist-packages'), sys.path ))[0]; sys.stdout.write(base)"
+PYTHON_MODULE_BASE := $(shell python -c $(PYTHON_BASE_SCRIPT))
+PYTHON3_MODULE_BASE := $(shell python3 -c $(PYTHON_BASE_SCRIPT))
+UFC_SUBDIR=ffc/backends/ufc
+PYTHON_UFC_DIR=$(PYTHON_MODULE_BASE)/$(UFC_SUBDIR)
+PYTHON3_UFC_DIR=$(PYTHON3_MODULE_BASE)/$(UFC_SUBDIR)
+
+
%:
dh $@ --with python2,python3 --buildsystem=pybuild
@@ -37,6 +45,13 @@ override_dh_auto_install:
rm debian/python3-ffc/usr/bin/ffc
mv debian/python3-ffc/usr/share/man/man1/ffc.1.gz debian/python3-ffc/usr/share/man/man1/ffc-3.1.gz
+override_dh_installdeb:
+ dh_installdeb
+ # handle alternatives for ufc.h
+ for pkg in $$(dh_listpackages -i); do \
+ sed -i -e 's|__PYTHON_UFC_DIR__|$(PYTHON_UFC_DIR)|; s|__PYTHON3_UFC_DIR__|$(PYTHON3_UFC_DIR)|' debian/$$pkg/DEBIAN/*; \
+ done
+
override_dh_gencontrol:
dh_gencontrol -- -Vsource:Next-Upstream-Version=$(FENICS_NEXT_VERSION)~
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/fenics/ffc.git
More information about the debian-science-commits
mailing list