Commit 2d0ec436499cdb4fe668377675abccf6ba8fbd74

Authored by Jürgen Knödlseder
1 parent 9119dabf

Add --branch option to Python coverage tool and forward also --coverage option f…

…or SWIG interface compilation.
configure.ac
@@ -758,6 +758,7 @@ fi @@ -758,6 +758,7 @@ fi
758 ############################################################################# 758 #############################################################################
759 # Initialise Python coverage with empty string 759 # Initialise Python coverage with empty string
760 PYTHON_COVERAGE= 760 PYTHON_COVERAGE=
  761 +COVERAGE_CXXFLAGS=
761 762
762 # Check for coverage option 763 # Check for coverage option
763 AC_MSG_CHECKING(whether to build ctools for code coverage measure) 764 AC_MSG_CHECKING(whether to build ctools for code coverage measure)
@@ -768,15 +769,17 @@ AC_ARG_ENABLE([coverage], @@ -768,15 +769,17 @@ AC_ARG_ENABLE([coverage],
768 [enable_coverage="no"]) 769 [enable_coverage="no"])
769 if test "x$enable_coverage" = "xyes"; then 770 if test "x$enable_coverage" = "xyes"; then
770 CXXFLAGS="--coverage $CXXFLAGS" 771 CXXFLAGS="--coverage $CXXFLAGS"
  772 + COVERAGE_CXXFLAGS="--coverage"
771 LDFLAGS="--coverage $LDFLAGS" 773 LDFLAGS="--coverage $LDFLAGS"
772 if test "x$has_python" = "xyes"; then 774 if test "x$has_python" = "xyes"; then
773 - PYTHON_COVERAGE="coverage run --append " 775 + PYTHON_COVERAGE="coverage run --branch --append "
774 fi 776 fi
775 AC_MSG_RESULT(yes) 777 AC_MSG_RESULT(yes)
776 else 778 else
777 AC_MSG_RESULT(no) 779 AC_MSG_RESULT(no)
778 fi 780 fi
779 AC_SUBST(PYTHON_COVERAGE) 781 AC_SUBST(PYTHON_COVERAGE)
  782 +AC_SUBST(COVERAGE_CXXFLAGS)
780 783
781 784
782 ############################################################################# 785 #############################################################################
@@ -937,7 +940,7 @@ OPENMP_LIB_LDFLAGS= @@ -937,7 +940,7 @@ OPENMP_LIB_LDFLAGS=
937 #fi 940 #fi
938 AC_SUBST(OPENMP_LIB_LDFLAGS) 941 AC_SUBST(OPENMP_LIB_LDFLAGS)
939 942
940 -# Signal if ctools cannot be compiled as gammalibe requires OpenMP but ctools 943 +# Signal if ctools cannot be compiled as gammalib requires OpenMP but ctools
941 # cannot be compiled with OpenMP 944 # cannot be compiled with OpenMP
942 if test "x$enable_openmp" = "xno" && test "x$gammalib_with_openmp" = "xyes"; then 945 if test "x$enable_openmp" = "xno" && test "x$gammalib_with_openmp" = "xyes"; then
943 AC_MSG_ERROR([The GammaLib library has been built with openMP support but OpenMP is not available on this system. Please install OpenMP or re-build GammaLib without OpenMP support.]) 946 AC_MSG_ERROR([The GammaLib library has been built with openMP support but OpenMP is not available on this system. Please install OpenMP or re-build GammaLib without OpenMP support.])
cscripts/cslightcrv.py
@@ -106,11 +106,18 @@ class cslightcrv(ctools.cscript): @@ -106,11 +106,18 @@ class cslightcrv(ctools.cscript):
106 # Get time boundaries 106 # Get time boundaries
107 self._tbins = self._create_tbounds() 107 self._tbins = self._create_tbounds()
108 108
109 - # Set stacked analysis flag if the requested number of energy bins  
110 - # is not zero; otherwise an unbinned analysis will be done.  
111 - self._stacked = False if self["enumbins"].integer() == 0 else True 109 + # Set stacked analysis flag to True if the requested number of
  110 + # energy bins is positive. Otherwise an unbinned analysis will
  111 + # be done and the stacked analysis flag will be set to False.
  112 + if self["enumbins"].integer() > 0:
  113 + self._stacked = True
  114 + else:
  115 + self._stacked = False
112 116
113 - # Make sure that other parameters are queried now and not later 117 + # Make sure that remaining user parameters are queried now. We
  118 + # do not store the actual parameter values as we do not want
  119 + # too many instance attributes with enhances the maintenance
  120 + # costs.
114 self["emin"].real() 121 self["emin"].real()
115 self["emax"].real() 122 self["emax"].real()
116 if self._stacked: 123 if self._stacked:
pyext/setup.py.in
@@ -108,10 +108,10 @@ data_files=[('@prefix@/share/ctools/swig', install_files)] @@ -108,10 +108,10 @@ data_files=[('@prefix@/share/ctools/swig', install_files)]
108 108
109 # Optionally enable OpenMP 109 # Optionally enable OpenMP
110 if '@OPENMP_TRUE@' != '#': 110 if '@OPENMP_TRUE@' != '#':
111 - extra_compile_args = ['@OPENMP_CXXFLAGS@'] 111 + extra_compile_args = ['@OPENMP_CXXFLAGS@','@COVERAGE_CXXFLAGS@']
112 extra_link_args = ['@OPENMP_CXXFLAGS@'] 112 extra_link_args = ['@OPENMP_CXXFLAGS@']
113 else: 113 else:
114 - extra_compile_args = [] 114 + extra_compile_args = ['@COVERAGE_CXXFLAGS@']
115 extra_link_args = [] 115 extra_link_args = []
116 116
117 # Optionally add link flag for El Capitan post-processing of modules 117 # Optionally add link flag for El Capitan post-processing of modules