[Debian-astro-maintainers] Bug#914596: python-casacore ftbfs with new casacore
peter green
plugwash at p10link.net
Thu Nov 29 14:29:08 GMT 2018
tags 914596 +patch
thanks
I noticed that python-casacore has a build-dependency on the cruft package libcasa-python3-2 , if it is mixing libraries from different versions of casacore then I imagine that could easily explain segfaults.
I went ahead and set the build-depends/conflicts for a consistent casacore 3 and also applied the boost patch from bug 914050, the build then failed with
src/fitting.cc: In function ‘void init_module__fitting()’:
src/fitting.cc:40:3: error: ‘casa’ has not been declared
casa::python::register_convert_excp();
That was fixed with a search and replace, which led me to.
src/quantamath.cc:53:7: error: conversion from ‘const casacore::Quantum<double>&()’ to non-scalar type ‘casacore::Quantity’ {aka ‘casacore::Quantum<double>’} requested
I googled for that error, followed some links and got to https://github.com/casacore/python-casacore/pull/137/commits/c9ed8316f4f8be3c6519138fb791b2107790d005 , a patch merged upstream which claimed to fix this issue, and the namespace problem, and also fixed an issue with string conversions. I removed my custom namespace patch and applied the upsteam patch instead.
With these changes I was able to get succesful builds in raspbian buster and debian sid amd64
Debdiff attatched and uploaded to raspbian, no intent to NMU in Debian
-------------- next part --------------
diff -Nru python-casacore-2.2.1/debian/changelog python-casacore-2.2.1/debian/changelog
--- python-casacore-2.2.1/debian/changelog 2017-11-29 10:22:50.000000000 +0000
+++ python-casacore-2.2.1/debian/changelog 2018-11-29 12:51:06.000000000 +0000
@@ -1,3 +1,15 @@
+python-casacore (2.2.1-1+rpi1) buster-staging; urgency=medium
+
+ * Update build-depends/conflicts for casacore 3
+ + version casacore dependency as >= 3
+ + move libcasa-python3-2 to build-conflicts
+ + add libcasa-python3-3 to build-depends
+ * Apply patch from https://salsa.debian.org/debian-astro-team/python-casacore/commit/e9c031474c3f3f4abaf4c83fa32311cc3857b2ee.diff
+ to fix build with new boost.
+ * Apply upsteam patch to fix build with casacore 3
+
+ -- Peter Michael Green <plugwash at raspbian.org> Thu, 29 Nov 2018 12:51:06 +0000
+
python-casacore (2.2.1-1) unstable; urgency=low
* New upstream version 2.2.1
diff -Nru python-casacore-2.2.1/debian/control python-casacore-2.2.1/debian/control
--- python-casacore-2.2.1/debian/control 2017-11-08 13:57:43.000000000 +0000
+++ python-casacore-2.2.1/debian/control 2018-11-29 12:51:06.000000000 +0000
@@ -3,11 +3,11 @@
Priority: optional
Maintainer: Debian Astro Team <debian-astro-maintainers at lists.alioth.debian.org>
Uploaders: Gijs Molenaar <gijs at pythonic.nl>, Ole Streicher <olebole at debian.org>
-Build-Depends: casacore-dev (>= 2.3.0),
+Build-Depends: casacore-dev (>= 3),
debhelper (>= 9),
dh-python,
libboost-python-dev,
- libcasa-python3-2,
+ libcasa-python3-3,
libcfitsio-dev | libcfitsio3-dev,
python-all (>= 2.6.6-3~),
python-all-dev,
@@ -20,6 +20,8 @@
python3-setuptools,
python3-six,
wcslib-dev
+Build-Conflicts:
+ libcasa-python3-2
Standards-Version: 4.1.1
Homepage: https://github.com/casacore/python-casacore
Vcs-Git: https://anonscm.debian.org/git/debian-astro/packages/python-casacore.git
diff -Nru python-casacore-2.2.1/debian/patches/casacore3.patch python-casacore-2.2.1/debian/patches/casacore3.patch
--- python-casacore-2.2.1/debian/patches/casacore3.patch 1970-01-01 00:00:00.000000000 +0000
+++ python-casacore-2.2.1/debian/patches/casacore3.patch 2018-11-29 12:51:06.000000000 +0000
@@ -0,0 +1,245 @@
+commit c9ed8316f4f8be3c6519138fb791b2107790d005
+Author: Ger van Diepen <diepen at astron.nl>
+Date: Tue Jun 26 12:26:14 2018 +0000
+
+ Fix issue #17, #135 and #136
+
+diff --git a/casacore/quanta/quantity.py b/casacore/quanta/quantity.py
+index e65f699..aa5a484 100644
+--- a/casacore/quanta/quantity.py
++++ b/casacore/quanta/quantity.py
+@@ -21,7 +21,7 @@ def new_get_value(quant, *args):
+ QuantVec.get_value = new_get_value
+
+
+-def to_string(quant, fmt="%0.5f"):
++def to_string(quant, fmt="%0.10g"):
+ val = quant.get_value()
+ if hasattr(val, "__len__"):
+ fmt = "[" + ", ".join([fmt % i for i in val]) + "] %s"
+@@ -38,7 +38,7 @@ Quantity.__str__ = to_string
+
+ # QuantVec.__repr__ = to_string
+ # Quantity.__repr__ = to_string
+-
++
+
+ def quantity(*args):
+ """Create a quantity. This can be from a scalar or vector.
+diff --git a/casacore/tables/table.py b/casacore/tables/table.py
+index 74e3ec2..9927c1d 100755
+--- a/casacore/tables/table.py
++++ b/casacore/tables/table.py
+@@ -1778,7 +1778,8 @@ class table(Table):
+ import os
+ # Test if casabrowser can be found.
+ # On OS-X 'which' always returns 0, so use test on top of it.
+- if os.system('test -x `which casabrowser` > /dev/null 2>&1') == 0:
++ # Nothing is written on stdout if not found.
++ if os.system('test `which casabrowser`x != x') == 0:
+ waitstr1 = ""
+ waitstr2 = "foreground ..."
+ if not wait:
+@@ -1813,7 +1814,7 @@ class table(Table):
+ try:
+ import wxPython
+ except ImportError:
+- six.print_('casabrowser nor wx available')
++ six.print_('casabrowser nor wxPython can be found')
+ return
+ from wxPython.wx import wxPySimpleApp
+ import sys
+diff --git a/src/fitting.cc b/src/fitting.cc
+index a8d2cb4..f27fdbc 100755
+--- a/src/fitting.cc
++++ b/src/fitting.cc
+@@ -37,8 +37,8 @@
+
+ BOOST_PYTHON_MODULE(_fitting)
+ {
+- casa::python::register_convert_excp();
+- casa::python::register_convert_basicdata();
+- casa::python::register_convert_casa_record();
+- casa::python::fit();
++ casacore::python::register_convert_excp();
++ casacore::python::register_convert_basicdata();
++ casacore::python::register_convert_casa_record();
++ casacore::python::fit();
+ }
+diff --git a/src/functionals.cc b/src/functionals.cc
+index 3e3d32b..b6f42bc 100755
+--- a/src/functionals.cc
++++ b/src/functionals.cc
+@@ -36,9 +36,9 @@
+
+ BOOST_PYTHON_MODULE(_functionals)
+ {
+- casa::python::register_convert_excp();
+- casa::python::register_convert_basicdata();
+- casa::python::register_convert_casa_record();
++ casacore::python::register_convert_excp();
++ casacore::python::register_convert_basicdata();
++ casacore::python::register_convert_casa_record();
+
+- casa::python::functional();
++ casacore::python::functional();
+ }
+diff --git a/src/images.cc b/src/images.cc
+index 5cbf36e..e54aead 100755
+--- a/src/images.cc
++++ b/src/images.cc
+@@ -41,16 +41,16 @@
+ BOOST_PYTHON_MODULE(_images)
+ {
+ // Register the required pyrap converters.
+- casa::python::register_convert_excp();
+- casa::python::register_convert_basicdata();
+- casa::python::register_convert_casa_valueholder();
+- casa::python::register_convert_casa_record();
+- casa::python::register_convert_std_vector<casa::ImageProxy>();
++ casacore::python::register_convert_excp();
++ casacore::python::register_convert_basicdata();
++ casacore::python::register_convert_casa_valueholder();
++ casacore::python::register_convert_casa_record();
++ casacore::python::register_convert_std_vector<casacore::ImageProxy>();
+
+ // Register the FITS and Miriad image types.
+- casa::FITSImage::registerOpenFunction();
+- casa::MIRIADImage::registerOpenFunction();
++ casacore::FITSImage::registerOpenFunction();
++ casacore::MIRIADImage::registerOpenFunction();
+
+ // Make python interface to images.
+- casa::python::pyimages();
++ casacore::python::pyimages();
+ }
+diff --git a/src/pymeasures.cc b/src/pymeasures.cc
+index 4988a0c..977bf2c 100755
+--- a/src/pymeasures.cc
++++ b/src/pymeasures.cc
+@@ -34,9 +34,9 @@
+
+ BOOST_PYTHON_MODULE(_measures)
+ {
+- casa::python::register_convert_excp();
+- casa::python::register_convert_basicdata();
+- casa::python::register_convert_casa_record();
++ casacore::python::register_convert_excp();
++ casacore::python::register_convert_basicdata();
++ casacore::python::register_convert_casa_record();
+
+- casa::python::pymeas();
++ casacore::python::pymeas();
+ }
+diff --git a/src/quanta.cc b/src/quanta.cc
+index 9c81b65..3c70c36 100755
+--- a/src/quanta.cc
++++ b/src/quanta.cc
+@@ -35,11 +35,11 @@
+
+ BOOST_PYTHON_MODULE(_quanta)
+ {
+- casa::python::register_convert_excp();
+- casa::python::register_convert_basicdata();
+- casa::python::register_convert_casa_record();
++ casacore::python::register_convert_excp();
++ casacore::python::register_convert_basicdata();
++ casacore::python::register_convert_casa_record();
+
+- casa::python::quantity();
+- casa::python::quantvec();
+- casa::python::quantamath();
++ casacore::python::quantity();
++ casacore::python::quantvec();
++ casacore::python::quantamath();
+ }
+diff --git a/src/quantamath.cc b/src/quantamath.cc
+index fb440f7..25201dd 100644
+--- a/src/quantamath.cc
++++ b/src/quantamath.cc
+@@ -47,9 +47,9 @@ namespace casacore {
+ };
+ static Quantity res[N] = {
+ Quantity(C::pi,""), Quantity(C::e,""),
+- QC::c, QC::G, QC::h, QC::HI, QC::R, QC::NA, QC::e, QC::mp,
+- QC::mp_me, QC::mu0, QC::epsilon0, QC::k, QC::F, QC::me, QC::re, QC::a0,
+- QC::R0, QC::k2
++ QC::c(), QC::G(), QC::h(), QC::HI(), QC::R(), QC::NA(), QC::e(),
++ QC::mp(), QC::mp_me(), QC::mu0(), QC::epsilon0(), QC::k(), QC::F(),
++ QC::me(), QC::re(), QC::a0(), QC::R0(), QC::k2()
+ };
+ for (int i=0; i<20;++i) {
+ d[types[i]] = res[i];
+diff --git a/src/tables.cc b/src/tables.cc
+index 857aab4..373a1ec 100755
+--- a/src/tables.cc
++++ b/src/tables.cc
+@@ -38,17 +38,17 @@
+
+ BOOST_PYTHON_MODULE(_tables)
+ {
+- casa::python::register_convert_excp();
+- casa::python::register_convert_basicdata();
+- casa::python::register_convert_casa_valueholder();
+- casa::python::register_convert_casa_record();
+- casa::python::register_convert_std_vector<casa::TableProxy>();
++ casacore::python::register_convert_excp();
++ casacore::python::register_convert_basicdata();
++ casacore::python::register_convert_casa_valueholder();
++ casacore::python::register_convert_casa_record();
++ casacore::python::register_convert_std_vector<casacore::TableProxy>();
+
+- casa::python::pytable();
+- casa::python::pytablerow();
+- casa::python::pytableiter();
+- casa::python::pytableindex();
++ casacore::python::pytable();
++ casacore::python::pytablerow();
++ casacore::python::pytableiter();
++ casacore::python::pytableindex();
+
+- casa::python::pyms();
++ casacore::python::pyms();
+ }
+
+diff --git a/tests/tConvert.cc b/tests/tConvert.cc
+index 3de10fd..8e2b227 100644
+--- a/tests/tConvert.cc
++++ b/tests/tConvert.cc
+@@ -30,13 +30,13 @@
+ #include <casacore/python/Converters/PycValueHolder.h>
+ #include <casacore/python/Converters/PycRecord.h>
+ #include <casacore/python/Converters/PycArray.h>
+-#include <casa/Arrays/ArrayIO.h>
++#include <casacore/casa/Arrays/ArrayIO.h>
+
+ #include <boost/python.hpp>
+
+ using namespace boost::python;
+
+-namespace casa { namespace pyrap {
++namespace casacore { namespace pyrap {
+
+ template<typename T>
+ std::ostream& operator<< (std::ostream& os, const std::vector<T>& vec)
+@@ -126,13 +126,13 @@ namespace casa { namespace pyrap {
+ BOOST_PYTHON_MODULE(_tConvert)
+ {
+ // Register the required converters.
+- casa::pyrap::register_convert_excp();
+- casa::pyrap::register_convert_basicdata();
+- casa::pyrap::register_convert_casa_valueholder();
+- casa::pyrap::register_convert_casa_record();
+- casa::pyrap::register_convert_std_vector<casa::uInt>();
+- casa::pyrap::register_convert_std_vector<std::vector<casa::uInt> >();
++ casacore::pyrap::register_convert_excp();
++ casacore::pyrap::register_convert_basicdata();
++ casacore::pyrap::register_convert_casa_valueholder();
++ casacore::pyrap::register_convert_casa_record();
++ casacore::pyrap::register_convert_std_vector<casacore::uInt>();
++ casacore::pyrap::register_convert_std_vector<std::vector<casacore::uInt> >();
+
+ // Execute the test.
+- casa::pyrap::testConvert();
++ casacore::pyrap::testConvert();
+ }
diff -Nru python-casacore-2.2.1/debian/patches/series python-casacore-2.2.1/debian/patches/series
--- python-casacore-2.2.1/debian/patches/series 2017-11-29 10:20:44.000000000 +0000
+++ python-casacore-2.2.1/debian/patches/series 2018-11-29 12:51:06.000000000 +0000
@@ -1 +1,2 @@
Set-default-library-name-for-libboost-python.patch
+casacore3.patch
diff -Nru python-casacore-2.2.1/debian/patches/Set-default-library-name-for-libboost-python.patch python-casacore-2.2.1/debian/patches/Set-default-library-name-for-libboost-python.patch
--- python-casacore-2.2.1/debian/patches/Set-default-library-name-for-libboost-python.patch 2017-11-29 10:20:44.000000000 +0000
+++ python-casacore-2.2.1/debian/patches/Set-default-library-name-for-libboost-python.patch 2018-11-29 12:51:06.000000000 +0000
@@ -1,21 +1,39 @@
-From: Ole Streicher <olebole at debian.org>
-Date: Wed, 8 Nov 2017 14:50:07 +0100
+From: Michael Hudson-Doyle <michael.hudson at ubuntu.com>
+Date: Fri, 9 Nov 2018 15:21:29 +1300
Subject: Set default library name for libboost-python
---
- setup.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ setup.py | 20 +-------------------
+ 1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/setup.py b/setup.py
-index 7ede7c0..9e78004 100755
+index 7ede7c0..6942ec5 100755
--- a/setup.py
+++ b/setup.py
-@@ -56,7 +56,7 @@ def find_boost():
- for libboostname in boostlibnames:
- if find_library_file(libboostname):
- return libboostname
-- return None
-+ return boostlibnames[0]
+@@ -44,25 +44,7 @@ if sys.version_info[0] == 2:
+ else:
+ casa_python = 'casa_python3'
+-
+-def find_boost():
+- """Find the name of the boost-python library. Returns None if none is found."""
+- boostlibnames = ['boost_python-py%s%s' % (sys.version_info[0], sys.version_info[1])]
+- boostlibnames += ['boost_python']
+- if sys.version_info[0] == 2:
+- boostlibnames += ["boost_python-mt"]
+- else:
+- boostlibnames += ["boost_python3-mt"]
+- for libboostname in boostlibnames:
+- if find_library_file(libboostname):
+- return libboostname
+- return None
+-
+-
+-boost_python = find_boost()
+-if not boost_python:
+- warnings.warn("Could not find a boost library")
+-
++boost_python = 'boost_python%s%s' % (sys.version_info[0], sys.version_info[1])
- boost_python = find_boost()
+ extension_metas = (
+ # name, sources, depends, libraries
More information about the Debian-astro-maintainers
mailing list