From e5bbf515591ff020606ff8949c3c69eee65c21a4 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 4 Apr 2017 14:23:19 +0200 Subject: [PATCH] If code originates from Git, always compile the Python bindings (#1985) --- ChangeLog | 1 + NEWS | 6 ++++++ configure.ac | 44 +++++++++++++++++++++++++++++++++----------- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 006eb2f..cdba62f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * Version 1.3.0 released ======================== + If code originates from Git, always compile the Python bindings (#1985) Raise exception instead of exiting with return code in Python tests (#1983) Support of map cubes lying outside RoI in ctobssim Support energy boundary FITS file in ctmapcube (#1978) diff --git a/NEWS b/NEWS index c2b03e8..79b1142 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,12 @@ The Python unit tests now raise exceptions instead of exiting with a non- zero return code so that the user is not thrown out of Python after calling ctools.test() and cscripts.test() (#1983). +If the code originates from the Git repository the configuration now switches +to developer mode which implies that the Python bindings are always built. +This solves the problem that occured for developers that could not get rid +of existing Python wrappers, even if they modified the Python interface +(#1985). + Python interface ---------------- diff --git a/configure.ac b/configure.ac index b16543d..c4326c8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ ############################################################################# # Configuration for ctools - tools for science analysis of CTA data # # ------------------------------------------------------------------------- # -# Copyright (C) 2011-2016 Juergen Knoedlseder # +# Copyright (C) 2011-2017 Juergen Knoedlseder # # ------------------------------------------------------------------------- # # # # This program is free software: you can redistribute it and/or modify # @@ -608,9 +608,10 @@ AC_C_INLINE # Python binding requires Python and either the files tools_wrap.cpp and # # tools.py or swig to create these files. The following conditionals are # # set: # -# WITH_PYTHON - Python bindings will be built # -# HAVE_SWIG - swig is available # -# HAVE_WRAPPERS - wrappers are available # +# WITH_PYTHON - Python bindings will be built # +# HAVE_SWIG - swig is available # +# HAVE_WRAPPERS - wrappers are available # +# BUILD_WRAPPERS - build the Python wrappers # ############################################################################# # Initialise flags enable_python="no" @@ -620,6 +621,12 @@ has_swig="no" has_wrappers="no" build_wrappers="no" +# Check if the code is a git clone. In that case the systems switches to +# developer mode which forces building of the Python interface with SWIG. +AC_CHECK_FILE([.git/HEAD], + [from_git=yes;build_wrappers="yes"], + [from_git=no]) + # Python binding enabled? AC_ARG_ENABLE([python-binding], AS_HELP_STRING([--enable-python-binding], @@ -1064,21 +1071,36 @@ else echo " - GammaLib support (no) no gammalib library found" fi +# Dump developer configuration +if test "x$from_git" = "xyes"; then + echo " * Developer configuration (yes)" +else + echo " * End user configuration (yes)" +fi + # Dump Python binding information if test "x$ac_enable_python_binding" = "xyes"; then if test "x$has_python" = "xyes"; then if test "x$has_python_h" = "xyes"; then - if test "x$has_wrappers" = "xyes"; then - if test "x$has_swig" = "xyes"; then - echo " * Make Python binding (yes) use swig for updates" + if test "x$build_wrappers" = "xyes"; then + if test "x$has_wrappers" = "xyes"; then + if test "x$has_swig" = "xyes"; then + echo " * Make Python binding (yes) use swig for updates" + else + echo " * Make Python binding (yes) use wrappers" + fi else - echo " * Make Python binding (yes) use wrappers" + if test "x$has_swig" = "xyes"; then + echo " * Make Python binding (yes) use swig for building" + else + echo " - Make Python binding (no) swig required to build wrappers" + fi fi else - if test "x$has_swig" = "xyes"; then - echo " * Make Python binding (yes) use swig for building" + if test "x$has_wrappers" = "xyes"; then + echo " - Make Python binding (yes) use existing wrappers" else - echo " - Make Python binding (no) swig required to build wrappers" + echo " - Make Python binding (no) wrappers not found" fi fi else -- libgit2 0.21.4