[openturns] 02/06: Add support for Python 3

Denis Barbier barbier-guest at moszumanska.debian.org
Tue Apr 28 23:21:51 UTC 2015


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

barbier-guest pushed a commit to branch debian
in repository openturns.

commit 85fd16c09cf0a82039f19d28168468bd541b3a8d
Author: Denis Barbier <bouzim at gmail.com>
Date:   Sun Apr 26 22:20:23 2015 +0100

    Add support for Python 3
    
    Remove obsolete stuff:
     * build dependencies on Fortran
     * Replaces/Breaks for versions which are no more in oldstable
---
 debian/control                   | 35 +++++++++++++++++------
 debian/python-openturns.install  |  4 +--
 debian/python3-openturns.install |  2 ++
 debian/rules                     | 62 +++++++++++++++++++++++-----------------
 4 files changed, 67 insertions(+), 36 deletions(-)

diff --git a/debian/control b/debian/control
index 1a7b793..0a039c9 100644
--- a/debian/control
+++ b/debian/control
@@ -3,16 +3,17 @@ Section: science
 Priority: extra
 Maintainer: Debian Science Maintainers <debian-science-maintainers at lists.alioth.debian.org>
 Uploaders: Christophe Prud'homme <prudhomm at debian.org>, Denis Barbier <barbier at debian.org>
-Build-Depends: debhelper (>= 8), quilt, gfortran, bison, flex, cmake, bc,
+Build-Depends: debhelper (>= 8), quilt, bison, flex, cmake, bc,
  libmuparser-dev, libxml2-dev, liblapack-dev, libblas-dev,
  libboost-math-dev, libhmat-oss-dev,
  libtbb-dev [i386 amd64 ia64],
- r-base-core, python-dev, swig
+ r-base-core, python-dev, python3-dev, swig
 Standards-Version: 3.9.5
 Homepage: http://www.openturns.org/
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-science/packages/openturns.git
 Vcs-Git: git://anonscm.debian.org/debian-science/packages/openturns.git
 X-Python-Version: current
+X-Python3-Version: current
 
 Package: libopenturns0.6
 Section: libs
@@ -39,7 +40,7 @@ Description: dynamic libraries for OpenTURNS
  The library implements almost all the treatments of uncertainty that
  OpenTURNS can provide. It is designed to be linked against any user
  specific application, or with either the textual front-end (see
- python-openturns package).
+ python-openturns or python3-openturns packages).
  .
  The main function of that library is giving to specific applications
  all the functionalities needed to treat uncertainties in
@@ -111,12 +112,32 @@ Description: Python front-end of OpenTURNS (aka TUI)
  This package provides a textual user interface that gives access to
  all the functionalities provided by the OpenTURNS library.
 
+Package: python3-openturns
+Section: python
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libopenturns0.6 (= ${binary:Version}), ${python3:Depends}
+Provides: ${python3:Provides}
+Suggests: python3-matplotlib, python3-scipy
+Description: Python3 front-end of OpenTURNS (aka TUI)
+ OpenTURNS is a powerful and generic tool to treat and quantify
+ uncertainties in numerical simulations in design, optimization and
+ control. It allows both sensitivity and reliability analysis studies:
+  * defining the outputs of interest and decision criterion;
+  * quantify and model the source of uncertainties;
+  * propagate uncertainties and/or analyse sensitivity and
+  * rank the sources of uncertainty
+ .
+ OpenTURNS is a large project with more than 300 C++ classes which
+ uses well known and supported software such as R for the statistical
+ methods and BLAS/LAPACK for the linear algebra.
+ .
+ This package provides a textual user interface with Python3 that gives
+ access to all the functionalities provided by the OpenTURNS library.
+
 Package: python-openturns-dev
 Section: python
 Architecture: any
-Depends: ${misc:Depends}, libopenturns-dev, python-openturns (= ${binary:Version}), python-dev
-Replaces: libopenturns-dev
-Breaks: libopenturns-dev (<< 1.0)
+Depends: ${misc:Depends}, libopenturns-dev,
 Description: Python front-end of OpenTURNS (aka TUI)
  OpenTURNS is a powerful and generic tool to treat and quantify
  uncertainties in numerical simulations in design, optimization and
@@ -136,8 +157,6 @@ Package: r-other-rot
 Section: gnu-r
 Architecture: any
 Depends: ${misc:Depends}, r-base-core
-Replaces: python-openturns
-Breaks: python-openturns (<< 1.0)
 Description: GNU R package of few tools needed by OpenTURNS
  OpenTURNS is a powerful and generic tool to treat and quantify
  uncertainties in numerical simulations in design, optimization and
diff --git a/debian/python-openturns.install b/debian/python-openturns.install
index 848f435..c1217d9 100644
--- a/debian/python-openturns.install
+++ b/debian/python-openturns.install
@@ -1,2 +1,2 @@
-usr/lib/python*/*-packages/openturns/*.py
-usr/lib/python*/*-packages/openturns/*.so
+usr/lib/python2*/*-packages/openturns/*.py
+usr/lib/python2*/*-packages/openturns/*.so
diff --git a/debian/python3-openturns.install b/debian/python3-openturns.install
new file mode 100644
index 0000000..9db1823
--- /dev/null
+++ b/debian/python3-openturns.install
@@ -0,0 +1,2 @@
+usr/lib/python3*/*-packages/openturns/*.py
+usr/lib/python3*/*-packages/openturns/*.so
diff --git a/debian/rules b/debian/rules
index 440314c..2d22bfd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -36,33 +36,32 @@ else
     with_tbb := -DUSE_TBB:BOOL=OFF
 endif
 
-# Explicitly set builddir directory
-builddir := obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-
 debRlib := $(CURDIR)/debian/tmp/usr/lib/R/site-library
 export R_LIBS=$(debRlib)
-PYVER = $(shell pyversions -dv)
+PYVER = $(shell pyversions -d)
+PY3VER = $(shell py3versions -d)
+PYALL = $(PYVER) $(PY3VER)
 
 %:
 ifneq (,$(findstring $(shell dpkg-architecture -qDEB_HOST_ARCH), mips mipsel))
 	$(error This package requires more than 1GB RAM; do not build on mips/mipsel)
 endif
-	dh $@ --buildsystem=cmake --builddirectory=$(builddir) --with python2 --with quilt --parallel
+	dh $@ --buildsystem=cmake --with python2,python3 --with quilt --parallel
 
 debian/tmp/usr/lib/R/site-library/rot:
 	-mkdir -p $(debRlib)
 	R CMD INSTALL --library=$(debRlib) utils/rot_1.4.5.tar.gz
 
-override_dh_auto_configure: debian/tmp/usr/lib/R/site-library/rot
-	dh_auto_configure -- \
+override_dh_auto_configure: debian/tmp/usr/lib/R/site-library/rot $(PYALL:python%=cmake-configure-%) \
+
+cmake-configure-%:
+	dh_auto_configure -Bbuild-python$* -- \
             $(with_tbb) \
             -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ \
-            -DCMAKE_Fortran_COMPILER:FILEPATH=/usr/bin/gfortran \
             -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc \
             -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
             -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING='$(cflags)' \
             -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING='$(cxxflags)' \
-            -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING='$(fflags)' \
             -DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING='$(ldflags)' \
             -DCMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING='$(ldflags)' \
             -DCMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING='$(ldflags)' \
@@ -74,26 +73,35 @@ override_dh_auto_configure: debian/tmp/usr/lib/R/site-library/rot
             -DOPENTURNS_WRAPPER_PATH:PATH=lib/openturns-1.5/wrappers \
             -DINSTALL_DESTDIR:PATH=$(CURDIR)/debian/tmp \
             -DLINK_PYTHON_LIBRARY:BOOL=OFF \
-            -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python \
-            -DPYTHON_INCLUDE_DIR:PATH=$$(python$(PYVER)-config --includes | sed -e 's/ .*//' -e 's/^-I//') \
-            -DPYTHON_INCLUDE_DIR2:PATH=$$(python$(PYVER)-config --includes | sed -e 's/ .*//' -e 's/^-I//') \
-            -DPYTHON_LIBRARY:PATH=$$(python$(PYVER)-config --ldflags | sed -e 's/ .*//' -e 's/^-L//')/libpython$(PYVER).so
-
-override_dh_auto_build:
-	$(MAKE) $(test_makeflags) -C $(builddir)/lib
-	$(MAKE) -j1 -C $(builddir)/python
-	$(MAKE) $(test_makeflags) -C $(builddir)
-
-override_dh_auto_install: debian/tmp/usr/lib/R/site-library/rot
-	dh_auto_install
+            -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python$* \
+            -DPYTHON_INCLUDE_DIR:PATH=$$(python$*-config --includes | sed -e 's/ .*//' -e 's/^-I//') \
+            -DPYTHON_LIBRARY:PATH=$$(python$*-config --ldflags | sed -e 's/ .*//' -e 's/^-L//')/libpython$*.so
+
+override_dh_auto_build: $(PY3VER:python%=cmake-test-py3-%) $(PYALL:python%=cmake-build-%)
+
+cmake-test-py3-%:
+	-mkdir -p python$*/test
+	cp python/test/*.py python$*/test
+	2to3 -w -n python$*/test
+	sed -i -e 's,python/test/\([^ ]*\)\.py,python$*/test/\1.py,g' build-python$*/python/test/CTestTestfile.cmake
+
+cmake-build-%:
+	$(MAKE) $(test_makeflags) -C build-python$*/lib
+	$(MAKE) -j1 -C build-python$*/python
+	$(MAKE) $(test_makeflags) -C build-python$*
+
+override_dh_auto_install: debian/tmp/usr/lib/R/site-library/rot $(PYALL:python%=cmake-install-%)
+
+cmake-install-%:
+	dh_auto_install -Bbuild-python$*
 	mkdir -p debian/libopenturns0.6-dbg/usr/lib/debug/usr/lib
 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
 	# CTestTestfile.cmake sets LD_LIBRARY_PATH to find libraries in debian/tmp.
 	# But it overrides current value, which breaks when run by fakeroot.
-	[ -z "$$LD_LIBRARY_PATH" ] || sed -i -e "s#;LD_LIBRARY_PATH=[^;]*#&:$$LD_LIBRARY_PATH#" $(builddir)/python/test/CTestTestfile.cmake
+	[ -z "$$LD_LIBRARY_PATH" ] || sed -i -e "s#;LD_LIBRARY_PATH=[^;]*#&:$$LD_LIBRARY_PATH#" build-python$*/python/test/CTestTestfile.cmake
 	CTEST_OUTPUT_ON_FAILURE=1 \
 	  R_LIBS_SITE=$(CURDIR)/debian/tmp/usr/lib/R/site-library \
-	  $(MAKE) $(test_makeflags) -C $(builddir) test ARGS="$(test_makeflags) -R pyinstallcheck" || { cat $(builddir)/Testing/Temporary/LastTest.log; false; }
+	  $(MAKE) $(test_makeflags) -C build-python$* test ARGS="$(test_makeflags) -R pyinstallcheck" || { cat build-python$*/Testing/Temporary/LastTest.log; false; }
 endif
 
 override_dh_makeshlibs:
@@ -109,11 +117,13 @@ override_dh_python2:
 override_dh_compress:
 	dh_compress -X.pdf -X.svn -X.py
 
-override_dh_auto_test:
+override_dh_auto_test: $(PYALL:python%=cmake-test-%)
+
+cmake-test-%:
 	# 'make test' does not build binary tests
 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
-	$(MAKE) $(test_makeflags) -C $(builddir) tests
-	CTEST_OUTPUT_ON_FAILURE=1 $(MAKE) -C $(builddir) test ARGS="$(test_makeflags) -R cppcheck" || { cat $(builddir)/Testing/Temporary/LastTest.log; false; }
+	$(MAKE) $(test_makeflags) -C build-python$* tests
+	CTEST_OUTPUT_ON_FAILURE=1 $(MAKE) -C build-python$* test ARGS="$(test_makeflags) -R cppcheck" || { cat build-python$*/Testing/Temporary/LastTest.log; false; }
 endif
 
 get-orig-source:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/openturns.git



More information about the debian-science-commits mailing list