Commit 1434a4864295119f224739ce7d5e16de80a0d23f

Authored by Jürgen Knödlseder
2 parents 1e21288d 858ffbbe

Merge branch '1826-fix-make-clean' into integration

# Conflicts:
#	ChangeLog
ChangeLog
... ... @@ -3,6 +3,7 @@
3 3 * Version 1.2.0 released
4 4 =========================
5 5  
  6 + Fix removal of Python wrappers after make clean (#1826)
6 7 Add GModelSpectralExpInvPlaw class (#1800)
7 8 Add GModelSpectralPlawEnergyFlux class (#1790)
8 9 Rename GModelSpectralPlaw2 to GModelSpectralPlawPhotonFlux (#1790)
... ...
... ... @@ -39,7 +39,9 @@ The return value of the following methods has been changed:
39 39  
40 40 3. Configuration
41 41 -----------------
42   -None
  42 +The Python wrappers were always removed when typing "make clean", even if
  43 +they had been shipped with the code. Now, the Python wrappers are only
  44 +removed in a "make clean" if they have been built (#1826).
43 45  
44 46  
45 47 4. Application module
... ...
pyext/Makefile.am
... ... @@ -263,12 +263,20 @@ uninstall-local:
263 263 # Set files to be removed in 'make clean'
264 264 CLEANFILES = $(CLEAN_FILES) $(DEPFILES)
265 265  
266   -# Files to be removed in build directory
  266 +# Files to be removed in build directory. Only remove wrapper files if the
  267 +# have been built or if the were copied in the build directory
267 268 clean-local:
268 269 rm -rf build
  270 +if BUILD_WRAPPERS
269 271 rm -rf $(builddir)/gammalib/*.py
270   - rm -rf $(builddir)/gammalib/*.pyc
271 272 rm -rf $(builddir)/gammalib/*_wrap.cpp
  273 +else
  274 + if test "x$(builddir)" != "x$(srcdir)"; then \
  275 + rm -rf $(builddir)/gammalib/*.py; \
  276 + rm -rf $(builddir)/gammalib/*_wrap.cpp; \
  277 + fi
  278 +endif
  279 + rm -rf $(builddir)/gammalib/*.pyc
272 280 rm -rf $(builddir)/gammalib/_*.so
273 281 rm -rf $(builddir)/gammalib/__pycache__
274 282  
... ...
pyext/setup.py.in
... ... @@ -153,8 +153,10 @@ if '@IS_ELCAPITAN_TRUE@' != '#':
153 153 for module in core_modules:
154 154  
155 155 # In case that wrappers were not built then copy the module wrapper files
156   - # from the source to the build directory
157   - if '@BUILD_WRAPPERS_FALSE@' != '#' and is_build:
  156 + # from the source to the build directory. Only do this if the build
  157 + # directory differs from the source directory
  158 + if '@BUILD_WRAPPERS_FALSE@' != '#' and is_build and \
  159 + '@srcdir@' != '@builddir@':
158 160 py_file = pkg_name+'/'+module+'.py'
159 161 cpp_file = pkg_name+'/'+module+'_wrap.cpp'
160 162 os.system('cp %s %s' % ('@srcdir@/'+cpp_file, '@builddir@/'+cpp_file))
... ... @@ -183,8 +185,10 @@ for module in inst_modules:
183 185 install_files.extend(glob.glob('@top_srcdir@/inst/'+module+'/pyext/*.i'))
184 186  
185 187 # In case that wrappers were not built then copy the module wrapper files
186   - # from the source to the build directory
187   - if '@BUILD_WRAPPERS_FALSE@' != '#' and is_build:
  188 + # from the source to the build directory. Only do this if the build
  189 + # directory differs from the source directory
  190 + if '@BUILD_WRAPPERS_FALSE@' != '#' and is_build and \
  191 + '@srcdir@' != '@builddir@':
188 192 py_file = pkg_name+'/'+module+'.py'
189 193 cpp_file = pkg_name+'/'+module+'_wrap.cpp'
190 194 os.system('cp %s %s' % ('@srcdir@/'+cpp_file, '@builddir@/'+cpp_file))
... ...