From a9dfb5f5b9a092ff3d5a23188e5d4f4fcb384840 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sun, 5 Mar 2017 07:45:54 +0100 Subject: [PATCH] Adjuste code so that it compiles on all Python versions --- cscripts/Makefile.am | 2 +- cscripts/cstsmapsplit.py | 4 +--- doc/source/users/tutorials/1dc/howto_tsmap.rst | 2 +- pyext/setup.py.in | 4 ++-- test/Makefile.am | 2 ++ 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cscripts/Makefile.am b/cscripts/Makefile.am index e13bc4e..0ad3188 100644 --- a/cscripts/Makefile.am +++ b/cscripts/Makefile.am @@ -241,7 +241,7 @@ uninstall-hook: # Files to be removed in build directory clean-local: - @if test '@srcdir@' != '@builddir@'; then \ + @if test '@top_srcdir@' != '@top_builddir@'; then \ rm -rf $(top_builddir)/cscripts/cs*.py; \ rm -rf $(top_builddir)/cscripts/obsutils.py; \ rm -rf $(top_builddir)/cscripts/modutils.py; \ diff --git a/cscripts/cstsmapsplit.py b/cscripts/cstsmapsplit.py index b134593..db736b6 100755 --- a/cscripts/cstsmapsplit.py +++ b/cscripts/cstsmapsplit.py @@ -286,9 +286,7 @@ class cstsmapsplit(ctools.cscript): f.close() # Make file executable - mode = os.stat(filename).st_mode - mode |= (mode & 0o444) >> 2 # copy R bits to X - os.chmod(filename, mode) + os.system('chmod +x %s' % filename) # Return return diff --git a/doc/source/users/tutorials/1dc/howto_tsmap.rst b/doc/source/users/tutorials/1dc/howto_tsmap.rst index 12b093d..4637c7d 100644 --- a/doc/source/users/tutorials/1dc/howto_tsmap.rst +++ b/doc/source/users/tutorials/1dc/howto_tsmap.rst @@ -77,7 +77,7 @@ The figure below shows the resulting Test Statistic map. Size of the Y axis in pixels [200] 10 Test source name [Crab] Src001 Output Test Statistic map file [tsmap.fits] tsmap_split.fits - Number of TS map bins per task [5] + Number of TS map bins per task [5] 10 Compute null hypothesis first? [yes] ASCII file containing all commands [commands.dat] tsmap_commands.dat diff --git a/pyext/setup.py.in b/pyext/setup.py.in index af975fe..4ff8900 100644 --- a/pyext/setup.py.in +++ b/pyext/setup.py.in @@ -141,8 +141,8 @@ if is_build: if '@BUILD_WRAPPERS_FALSE@' != '#': py_file = pkg_name+'/tools.py' cpp_file = pkg_name+'/tools_wrap.cpp' - os.system('cp %s %s' % ('@srcdir@/'+cpp_file, '@builddir@/'+cpp_file)) - os.system('cp %s %s' % ('@srcdir@/'+py_file, '@builddir@/'+py_file)) + os.system('cp %s %s' % ('@top_srcdir@/pyext/'+cpp_file, '@top_builddir@/pyext/'+cpp_file)) + os.system('cp %s %s' % ('@top_srcdir@/pyext/'+py_file, '@top_builddir@/pyext/'+py_file)) # In case that the build directory is different from the source directory # then copy all cscripts and parfiles from the source directory to the diff --git a/test/Makefile.am b/test/Makefile.am index 5dc4f9e..c5d23fa 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -49,6 +49,8 @@ all-local: # Files to be removed in build directory clean-local: + rm -rf $(top_builddir)/test/*.pyc + rm -rf $(top_builddir)/test/__pycache__ rm -rf $(top_builddir)/test/*.fits rm -rf $(top_builddir)/test/*.log rm -rf $(top_builddir)/test/*.xml -- libgit2 0.21.4