Commit e5bbf515591ff020606ff8949c3c69eee65c21a4

Authored by Jürgen Knödlseder
1 parent 166d83b7

If code originates from Git, always compile the Python bindings (#1985)

ChangeLog
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 * Version 1.3.0 released 3 * Version 1.3.0 released
4 ======================== 4 ========================
5 5
  6 + If code originates from Git, always compile the Python bindings (#1985)
6 Raise exception instead of exiting with return code in Python tests (#1983) 7 Raise exception instead of exiting with return code in Python tests (#1983)
7 Support of map cubes lying outside RoI in ctobssim 8 Support of map cubes lying outside RoI in ctobssim
8 Support energy boundary FITS file in ctmapcube (#1978) 9 Support energy boundary FITS file in ctmapcube (#1978)
@@ -15,6 +15,12 @@ The Python unit tests now raise exceptions instead of exiting with a non- @@ -15,6 +15,12 @@ The Python unit tests now raise exceptions instead of exiting with a non-
15 zero return code so that the user is not thrown out of Python after calling 15 zero return code so that the user is not thrown out of Python after calling
16 ctools.test() and cscripts.test() (#1983). 16 ctools.test() and cscripts.test() (#1983).
17 17
  18 +If the code originates from the Git repository the configuration now switches
  19 +to developer mode which implies that the Python bindings are always built.
  20 +This solves the problem that occured for developers that could not get rid
  21 +of existing Python wrappers, even if they modified the Python interface
  22 +(#1985).
  23 +
18 24
19 Python interface 25 Python interface
20 ---------------- 26 ----------------
configure.ac
1 ############################################################################# 1 #############################################################################
2 # Configuration for ctools - tools for science analysis of CTA data # 2 # Configuration for ctools - tools for science analysis of CTA data #
3 # ------------------------------------------------------------------------- # 3 # ------------------------------------------------------------------------- #
4 -# Copyright (C) 2011-2016 Juergen Knoedlseder # 4 +# Copyright (C) 2011-2017 Juergen Knoedlseder #
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # This program is free software: you can redistribute it and/or modify # 7 # This program is free software: you can redistribute it and/or modify #
@@ -608,9 +608,10 @@ AC_C_INLINE @@ -608,9 +608,10 @@ AC_C_INLINE
608 # Python binding requires Python and either the files tools_wrap.cpp and # 608 # Python binding requires Python and either the files tools_wrap.cpp and #
609 # tools.py or swig to create these files. The following conditionals are # 609 # tools.py or swig to create these files. The following conditionals are #
610 # set: # 610 # set: #
611 -# WITH_PYTHON - Python bindings will be built #  
612 -# HAVE_SWIG - swig is available #  
613 -# HAVE_WRAPPERS - wrappers are available # 611 +# WITH_PYTHON - Python bindings will be built #
  612 +# HAVE_SWIG - swig is available #
  613 +# HAVE_WRAPPERS - wrappers are available #
  614 +# BUILD_WRAPPERS - build the Python wrappers #
614 ############################################################################# 615 #############################################################################
615 # Initialise flags 616 # Initialise flags
616 enable_python="no" 617 enable_python="no"
@@ -620,6 +621,12 @@ has_swig="no" @@ -620,6 +621,12 @@ has_swig="no"
620 has_wrappers="no" 621 has_wrappers="no"
621 build_wrappers="no" 622 build_wrappers="no"
622 623
  624 +# Check if the code is a git clone. In that case the systems switches to
  625 +# developer mode which forces building of the Python interface with SWIG.
  626 +AC_CHECK_FILE([.git/HEAD],
  627 + [from_git=yes;build_wrappers="yes"],
  628 + [from_git=no])
  629 +
623 # Python binding enabled? 630 # Python binding enabled?
624 AC_ARG_ENABLE([python-binding], 631 AC_ARG_ENABLE([python-binding],
625 AS_HELP_STRING([--enable-python-binding], 632 AS_HELP_STRING([--enable-python-binding],
@@ -1064,21 +1071,36 @@ else @@ -1064,21 +1071,36 @@ else
1064 echo " - GammaLib support (no) no gammalib library found" 1071 echo " - GammaLib support (no) no gammalib library found"
1065 fi 1072 fi
1066 1073
  1074 +# Dump developer configuration
  1075 +if test "x$from_git" = "xyes"; then
  1076 + echo " * Developer configuration (yes)"
  1077 +else
  1078 + echo " * End user configuration (yes)"
  1079 +fi
  1080 +
1067 # Dump Python binding information 1081 # Dump Python binding information
1068 if test "x$ac_enable_python_binding" = "xyes"; then 1082 if test "x$ac_enable_python_binding" = "xyes"; then
1069 if test "x$has_python" = "xyes"; then 1083 if test "x$has_python" = "xyes"; then
1070 if test "x$has_python_h" = "xyes"; then 1084 if test "x$has_python_h" = "xyes"; then
1071 - if test "x$has_wrappers" = "xyes"; then  
1072 - if test "x$has_swig" = "xyes"; then  
1073 - echo " * Make Python binding (yes) use swig for updates" 1085 + if test "x$build_wrappers" = "xyes"; then
  1086 + if test "x$has_wrappers" = "xyes"; then
  1087 + if test "x$has_swig" = "xyes"; then
  1088 + echo " * Make Python binding (yes) use swig for updates"
  1089 + else
  1090 + echo " * Make Python binding (yes) use wrappers"
  1091 + fi
1074 else 1092 else
1075 - echo " * Make Python binding (yes) use wrappers" 1093 + if test "x$has_swig" = "xyes"; then
  1094 + echo " * Make Python binding (yes) use swig for building"
  1095 + else
  1096 + echo " - Make Python binding (no) swig required to build wrappers"
  1097 + fi
1076 fi 1098 fi
1077 else 1099 else
1078 - if test "x$has_swig" = "xyes"; then  
1079 - echo " * Make Python binding (yes) use swig for building" 1100 + if test "x$has_wrappers" = "xyes"; then
  1101 + echo " - Make Python binding (yes) use existing wrappers"
1080 else 1102 else
1081 - echo " - Make Python binding (no) swig required to build wrappers" 1103 + echo " - Make Python binding (no) wrappers not found"
1082 fi 1104 fi
1083 fi 1105 fi
1084 else 1106 else