Commit adc6fa6c94dc90ed430de5e01f7dbd9f67e26fbe

Authored by Jürgen Knödlseder
1 parent 9c23d585

Copy shared Python libraries instead of creating a symbolic link (#1987)

ChangeLog
1 -2017-04-04 1 +2017-04-05
2 2
3 * Version 1.3.0 released 3 * Version 1.3.0 released
4 ========================= 4 =========================
5 5
  6 + Copy shared Python libraries instead of creating a symbolic link (#1987)
6 Added FITS image conversion operators (#1986) 7 Added FITS image conversion operators (#1986)
7 If code originates from Git, always compile the Python bindings (#1985) 8 If code originates from Git, always compile the Python bindings (#1985)
8 Raise exception instead of exiting with return code in Python tests (#1983) 9 Raise exception instead of exiting with return code in Python tests (#1983)
1 New Features and Important Changes in GammaLib 1.3.0.dev1 1 New Features and Important Changes in GammaLib 1.3.0.dev1
2 2
3 -4 April 2017 3 +5 April 2017
4 4
5 5
6 1. Introduction 6 1. Introduction
@@ -54,6 +54,10 @@ This solves the problem that occured for developers that could not get rid @@ -54,6 +54,10 @@ This solves the problem that occured for developers that could not get rid
54 of existing Python wrappers, even if they modified the Python interface 54 of existing Python wrappers, even if they modified the Python interface
55 (#1985). 55 (#1985).
56 56
  57 +The shared libraries needed by the Python wrappers are now copied into a
  58 +build/gammalib directory for unit testing instead of creating a symbolic
  59 +link since on shared VM file systems symbolic links may not work (#1987).
  60 +
57 61
58 4. Application module 62 4. Application module
59 --------------------- 63 ---------------------
inst/cta/src/GCTACubeExposure.cpp
@@ -701,11 +701,9 @@ void GCTACubeExposure::fill_cube(const GCTAObservation& obs, GLog* log) @@ -701,11 +701,9 @@ void GCTACubeExposure::fill_cube(const GCTAObservation& obs, GLog* log)
701 // approximation, but probably the only we can really do. 701 // approximation, but probably the only we can really do.
702 // We allow here for a small margin in case of rounding 702 // We allow here for a small margin in case of rounding
703 // errors in the energy boundaries. 703 // errors in the energy boundaries.
704 -//std::cout << obs_ebounds.emin() << " <= " << m_energies[iebin] << " <= " << obs_ebounds.emax() << std::endl;  
705 if (!(obs_ebounds.contains(m_energies[iebin]) || 704 if (!(obs_ebounds.contains(m_energies[iebin]) ||
706 obs_ebounds.contains(m_energies[iebin]-margin) || 705 obs_ebounds.contains(m_energies[iebin]-margin) ||
707 obs_ebounds.contains(m_energies[iebin]+margin))) { 706 obs_ebounds.contains(m_energies[iebin]+margin))) {
708 -//std::cout << "Skip" << std::endl;  
709 continue; 707 continue;
710 } 708 }
711 709
pyext/setup.py.in
1 ############################################################################# 1 #############################################################################
2 # Disutils setup file for gammalib Python extension module # 2 # Disutils setup file for gammalib Python extension module #
3 # ------------------------------------------------------------------------- # 3 # ------------------------------------------------------------------------- #
4 -# Copyright (C) 2011-2016 Juergen Knoedlseder # 4 +# Copyright (C) 2011-2017 Juergen Knoedlseder #
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # This program is free software: you can redistribute it and/or modify # 7 # This program is free software: you can redistribute it and/or modify #
@@ -24,6 +24,7 @@ import glob @@ -24,6 +24,7 @@ import glob
24 import os 24 import os
25 import sys 25 import sys
26 import re 26 import re
  27 +import shutil
27 28
28 # Define package name 29 # Define package name
29 pkg_name = 'gammalib' 30 pkg_name = 'gammalib'
@@ -228,19 +229,34 @@ setup(name=&#39;@PACKAGE_NAME@&#39;, @@ -228,19 +229,34 @@ setup(name=&#39;@PACKAGE_NAME@&#39;,
228 platforms=['Linux', 'Solaris', 'Mac OS-X', 'Unix', 'BSD'], 229 platforms=['Linux', 'Solaris', 'Mac OS-X', 'Unix', 'BSD'],
229 ) 230 )
230 231
231 -# Post-processing. A symbolic link is created to the directory containing the  
232 -# shared wrapper libraries so that we can add this directory to the PYTHONPATH  
233 -# for testing. 232 +# Post-processing. The shared wrapper libraries are copied into the
  233 +# build/gammalib directory and this directory is appended to the PYTHONPATH
  234 +# so that shared libraries can be accessed during unit testing. This kluge
  235 +# is needed since the name of the build directory where the shared libraries
  236 +# reside is not known when building the Makefile.
234 if is_build: 237 if is_build:
  238 +
  239 + # Remove existing build/gammalib directory
235 try: 240 try:
236 - os.chdir('build')  
237 - os.remove('gammalib')  
238 - print('Removed symbolic link build/gammalib.') 241 + os.remove('build/gammalib')
  242 + print('Removed "build/gammalib" directory.')
239 except: 243 except:
240 pass 244 pass
  245 +
  246 + # Create build/gammalib directory
241 try: 247 try:
242 - path = glob.glob('lib.*/gammalib')  
243 - os.symlink(path[0], 'gammalib')  
244 - print('Created symbolic link build/gammalib.') 248 + os.mkdir('build/gammalib')
  249 + print('Created "build/gammalib" directory.')
  250 + except (OSError):
  251 + print('Directory "build/gammalib" exists already.')
245 except: 252 except:
246 - print('WARNING: Failed to create symbolic link build/gammalib.') 253 + print('ERROR: Failed to create directory "build/gammalib".')
  254 + raise
  255 +
  256 + # Copy over shared libraries from lib.*/gammalib folder
  257 + files = glob.glob('build/lib.*/gammalib/_*.so')
  258 + for file in files:
  259 + dst = os.path.join('build/gammalib', os.path.basename(file))
  260 + shutil.copy2(file, dst)
  261 + print('Copied %s -> %s' % (file, dst))
  262 + print('Copied shared libraries into "build/gammalib" directory.')