diff --git a/ChangeLog b/ChangeLog index 19819a4..0f86db5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * Version 1.2.0 released ========================= + Fix removal of Python wrappers after make clean (#1826) Add GModelSpectralPlawEnergyFlux class (#1790) Rename GModelSpectralPlaw2 to GModelSpectralPlawPhotonFlux (#1790) diff --git a/NEWS b/NEWS index bfc4e8d..d057ebd 100644 --- a/NEWS +++ b/NEWS @@ -38,7 +38,9 @@ The return value of the following methods has been changed: 3. Configuration ----------------- -None +The Python wrappers were always removed when typing "make clean", even if +they had been shipped with the code. Now, the Python wrappers are only +removed in a "make clean" if they have been built (#1826). 4. Application module diff --git a/pyext/Makefile.am b/pyext/Makefile.am index e6e8b1e..f1e3d92 100755 --- a/pyext/Makefile.am +++ b/pyext/Makefile.am @@ -263,12 +263,20 @@ uninstall-local: # Set files to be removed in 'make clean' CLEANFILES = $(CLEAN_FILES) $(DEPFILES) -# Files to be removed in build directory +# Files to be removed in build directory. Only remove wrapper files if the +# have been built or if the were copied in the build directory clean-local: rm -rf build +if BUILD_WRAPPERS rm -rf $(builddir)/gammalib/*.py - rm -rf $(builddir)/gammalib/*.pyc rm -rf $(builddir)/gammalib/*_wrap.cpp +else + if test "x$(builddir)" != "x$(srcdir)"; then \ + rm -rf $(builddir)/gammalib/*.py; \ + rm -rf $(builddir)/gammalib/*_wrap.cpp; \ + fi +endif + rm -rf $(builddir)/gammalib/*.pyc rm -rf $(builddir)/gammalib/_*.so rm -rf $(builddir)/gammalib/__pycache__ diff --git a/pyext/setup.py.in b/pyext/setup.py.in index 1b61b8b..8041ed3 100644 --- a/pyext/setup.py.in +++ b/pyext/setup.py.in @@ -153,8 +153,10 @@ if '@IS_ELCAPITAN_TRUE@' != '#': for module in core_modules: # In case that wrappers were not built then copy the module wrapper files - # from the source to the build directory - if '@BUILD_WRAPPERS_FALSE@' != '#' and is_build: + # from the source to the build directory. Only do this if the build + # directory differs from the source directory + if '@BUILD_WRAPPERS_FALSE@' != '#' and is_build and \ + '@srcdir@' != '@builddir@': py_file = pkg_name+'/'+module+'.py' cpp_file = pkg_name+'/'+module+'_wrap.cpp' os.system('cp %s %s' % ('@srcdir@/'+cpp_file, '@builddir@/'+cpp_file)) @@ -183,8 +185,10 @@ for module in inst_modules: install_files.extend(glob.glob('@top_srcdir@/inst/'+module+'/pyext/*.i')) # In case that wrappers were not built then copy the module wrapper files - # from the source to the build directory - if '@BUILD_WRAPPERS_FALSE@' != '#' and is_build: + # from the source to the build directory. Only do this if the build + # directory differs from the source directory + if '@BUILD_WRAPPERS_FALSE@' != '#' and is_build and \ + '@srcdir@' != '@builddir@': py_file = pkg_name+'/'+module+'.py' cpp_file = pkg_name+'/'+module+'_wrap.cpp' os.system('cp %s %s' % ('@srcdir@/'+cpp_file, '@builddir@/'+cpp_file))