Commit df508d5ff1883fe305f95393d436c73d90bb5c26
Merge branch 'devel' of https://cta-gitlab.irap.omp.eu/ctools/ctools into 1862_butterfly
Showing
8 changed files
with
68 additions
and
28 deletions
ChangeLog
| 1 | -2017-03-28 | |
| 1 | +2017-04-05 | |
| 2 | 2 | |
| 3 | 3 | * Version 1.3.0 released |
| 4 | 4 | ======================== |
| 5 | 5 | |
| 6 | + Copy cscripts into bin directory instead of creating a symbolic links (#1987) | |
| 7 | + If code originates from Git, always compile the Python bindings (#1985) | |
| 8 | + Raise exception instead of exiting with return code in Python tests (#1983) | |
| 6 | 9 | Support of map cubes lying outside RoI in ctobssim |
| 7 | 10 | Support energy boundary FITS file in ctmapcube (#1978) |
| 8 | 11 | Add csebins script (#1976) | ... | ... |
NEWS
| 1 | 1 | New Features and Important Changes in ctools 1.3.0.dev1 |
| 2 | 2 | |
| 3 | -28 March 2017 | |
| 3 | +5 April 2017 | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | Introduction |
| ... | ... | @@ -11,7 +11,19 @@ ctools release with respect to the precedent release. |
| 11 | 11 | |
| 12 | 12 | Configuration |
| 13 | 13 | ------------- |
| 14 | -None | |
| 14 | +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 | |
| 16 | +ctools.test() and cscripts.test() (#1983). | |
| 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 | + | |
| 24 | +The cscripts are now copied into the bin directory upon installation instead | |
| 25 | +of creating symbolic links. This avoids problems on some VM file systems on | |
| 26 | +which creation of symbolic links does not work (#1987). | |
| 15 | 27 | |
| 16 | 28 | |
| 17 | 29 | Python interface | ... | ... |
configure.ac
| 1 | 1 | ############################################################################# |
| 2 | 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 | 7 | # This program is free software: you can redistribute it and/or modify # |
| ... | ... | @@ -608,9 +608,10 @@ AC_C_INLINE |
| 608 | 608 | # Python binding requires Python and either the files tools_wrap.cpp and # |
| 609 | 609 | # tools.py or swig to create these files. The following conditionals are # |
| 610 | 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 | 616 | # Initialise flags |
| 616 | 617 | enable_python="no" |
| ... | ... | @@ -620,6 +621,12 @@ has_swig="no" |
| 620 | 621 | has_wrappers="no" |
| 621 | 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 | 630 | # Python binding enabled? |
| 624 | 631 | AC_ARG_ENABLE([python-binding], |
| 625 | 632 | AS_HELP_STRING([--enable-python-binding], |
| ... | ... | @@ -1064,21 +1071,36 @@ else |
| 1064 | 1071 | echo " - GammaLib support (no) no gammalib library found" |
| 1065 | 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 | 1081 | # Dump Python binding information |
| 1068 | 1082 | if test "x$ac_enable_python_binding" = "xyes"; then |
| 1069 | 1083 | if test "x$has_python" = "xyes"; then |
| 1070 | 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 | 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 | 1098 | fi |
| 1077 | 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 | 1102 | else |
| 1081 | - echo " - Make Python binding (no) swig required to build wrappers" | |
| 1103 | + echo " - Make Python binding (no) wrappers not found" | |
| 1082 | 1104 | fi |
| 1083 | 1105 | fi |
| 1084 | 1106 | else | ... | ... |
cscripts/Makefile.am
| ... | ... | @@ -223,7 +223,7 @@ EXTRA_DIST = $(binscripts) $(pythonscripts) $(parfiles) \ |
| 223 | 223 | $(testscripts) $(testdata) $(testiactdata) \ |
| 224 | 224 | $(testiactevents) |
| 225 | 225 | |
| 226 | -# Add install hook rule to create symbolic links for cscripts | |
| 226 | +# Add install hook rule to copy cscripts without .py into the bindir | |
| 227 | 227 | install-data-hook: |
| 228 | 228 | @binlist='$(binscripts)';\ |
| 229 | 229 | for p in $$binlist; do \ |
| ... | ... | @@ -232,11 +232,11 @@ install-data-hook: |
| 232 | 232 | @linklist='$(linkscripts)';\ |
| 233 | 233 | for p in $$linklist; do \ |
| 234 | 234 | rm -rf "$(DESTDIR)$(bindir)/$$p"; \ |
| 235 | - ln -s "$(DESTDIR)$(pyexecdir)/cscripts/$$p.py" "$(DESTDIR)$(bindir)/$$p"; \ | |
| 236 | - chmod +x "$(DESTDIR)$(pyexecdir)/cscripts/$$p.py"; \ | |
| 235 | + cp "$(DESTDIR)$(pyexecdir)/cscripts/$$p.py" "$(DESTDIR)$(bindir)/$$p"; \ | |
| 236 | + chmod +x "$(DESTDIR)$(bindir)/$$p"; \ | |
| 237 | 237 | done |
| 238 | 238 | |
| 239 | -# Uninstall hook rule to remove the symbolic links for cscripts | |
| 239 | +# Uninstall hook rule to remove the cscripts from the bindir | |
| 240 | 240 | uninstall-hook: |
| 241 | 241 | @linklist='$(linkscripts)';\ |
| 242 | 242 | for p in $$linklist; do \ | ... | ... |
test/test_ctbin.py
| ... | ... | @@ -30,7 +30,7 @@ from testing import test |
| 30 | 30 | class Test(test): |
| 31 | 31 | """ |
| 32 | 32 | Test class for ctbin tool |
| 33 | - | |
| 33 | + | |
| 34 | 34 | This test class makes unit tests for the ctbin tool by using it from |
| 35 | 35 | the command line and from Python. |
| 36 | 36 | """ |
| ... | ... | @@ -280,7 +280,7 @@ class Test(test): |
| 280 | 280 | def _check_observation(self, ctbin, nevents, multiplier=1): |
| 281 | 281 | """ |
| 282 | 282 | Check content of an observation |
| 283 | - | |
| 283 | + | |
| 284 | 284 | Parameters |
| 285 | 285 | ---------- |
| 286 | 286 | ctbin : `~ctools.ctbin` |
| ... | ... | @@ -316,7 +316,7 @@ class Test(test): |
| 316 | 316 | def _check_cube(self, cube, nevents, multiplier=1): |
| 317 | 317 | """ |
| 318 | 318 | Check content of event cube |
| 319 | - | |
| 319 | + | |
| 320 | 320 | Parameters |
| 321 | 321 | ---------- |
| 322 | 322 | cube : `~gammalib.GCTAEventCube` | ... | ... |
test/test_examples.py.in
test/test_python_cscripts.py
| ... | ... | @@ -184,8 +184,9 @@ def test(installed=False, debug=False): |
| 184 | 184 | if installed: |
| 185 | 185 | os.system('rm -rf %s' % (path)) |
| 186 | 186 | |
| 187 | - # Exit with return code | |
| 188 | - sys.exit(rc) | |
| 187 | + # Raise an exception in case of failure | |
| 188 | + if not success: | |
| 189 | + raise RuntimeError('At least one error occured during the test.') | |
| 189 | 190 | |
| 190 | 191 | |
| 191 | 192 | # ======================== # | ... | ... |
test/test_python_ctools.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the ctools package |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2012-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2012-2017 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -143,8 +143,9 @@ def test(installed=False): |
| 143 | 143 | if installed: |
| 144 | 144 | os.system('rm -rf %s' % (path)) |
| 145 | 145 | |
| 146 | - # Exit with return code | |
| 147 | - sys.exit(rc) | |
| 146 | + # Raise an exception in case of failure | |
| 147 | + if not success: | |
| 148 | + raise RuntimeError('At least one error occured during the test.') | |
| 148 | 149 | |
| 149 | 150 | |
| 150 | 151 | # ======================== # | ... | ... |