From: regrain Date: Wed, 12 Jan 2005 15:23:43 +0000 (+0000) Subject: * Bug fix for the python part use X-Git-Tag: Version1.0.bp~374 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=ed96b11a44a8e6ee7c3d091d069a04a683cdf2f6;p=gdcm.git * Bug fix for the python part use -- BeNours --- diff --git a/ChangeLog b/ChangeLog index 86e8643a..dea2eff9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2005-01-11 Benoit Regrain + * Bug fix for the python part use + 2005-01-11 Benoit Regrain * gdcmPython/gdcm.i : bug fix when compiling with MSCV diff --git a/gdcmPython/CMakeLists.txt b/gdcmPython/CMakeLists.txt index 04a30511..b6f7322b 100644 --- a/gdcmPython/CMakeLists.txt +++ b/gdcmPython/CMakeLists.txt @@ -15,7 +15,7 @@ INCLUDE_DIRECTORIES( IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) # We need to pass that to swig to be sure all modules are generated in the proper dir - SET(CMAKE_SWIG_FLAGS "-outdir ${GDCM_BINARY_DIR}/bin") + SET(CMAKE_SWIG_FLAGS "-outdir ${GDCM_BINARY_DIR}/gdcmPython") # Looks like a bug to me in cmake 2.0.x: SEPARATE_ARGUMENTS(CMAKE_SWIG_FLAGS) @@ -193,14 +193,14 @@ IF(GDCM_VTK) ENDIF (GDCM_WRAP_PYTHON) ENDIF(GDCM_VTK) - # generate a setup.py according to VTK installation - # put it in subdir in order to not override old one - - GET_FILENAME_COMPONENT(VTKPATH ${VTK_DIR}/../../ ABSOLUTE) - CONFIGURE_FILE( - ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in - ${GDCM_BINARY_DIR}/setup.py - ) +# generate a setup.py according to VTK installation +# put it in subdir in order to not override old one + +GET_FILENAME_COMPONENT(VTKPATH ${VTK_DIR}/../../ ABSOLUTE) +CONFIGURE_FILE( + ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in + ${GDCM_BINARY_DIR}/setup.py +) #----------------------------------------------------------------------------- # Install stuff: @@ -211,24 +211,46 @@ ENDIF(GDCM_VTK) # Create a gdcm.pth file: +FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/gdcmVersion.py + "gdcmVERSION=\"${GDCM_VERSION}\"\n" + ) + FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/gdcm.pth "gdcmPython\n" ) FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/__init__.py + "__all__ = [\"core\",\n" + " \"vtk\",\n" + " ]\n" + ) + +FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/core.py "import gdcm\n" + "GDCM_DATA_PATH =\"${GDCM_DATA_ROOT}\"\n" + "GDCM_TEST_DATA_PATH=\"${GDCM_DATA_ROOT}\"\n" ) IF(GDCM_VTK) - FILE(APPEND ${GDCM_BINARY_DIR}/gdcmPython/__init__.py + FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/vtk.py "import os\n" "if os.name == 'posix':\n" " from libvtkgdcmPython import *\n" "else:\n" " from vtkgdcmPython import *\n" + "GDCM_DATA_PATH =\"${GDCM_DATA_ROOT}\"\n" + "GDCM_TEST_DATA_PATH=\"${GDCM_DATA_ROOT}\"\n" ) ENDIF(GDCM_VTK) +#----------------------------------------------------------------------------- +# Copy the testSuite.py file +CONFIGURE_FILE( + ${GDCM_SOURCE_DIR}/gdcmPython/testSuite.py + ${GDCM_BINARY_DIR}/gdcmPython/testSuite.py + COPYONLY +) + #----------------------------------------------------------------------------- # Add test from demo subdir: diff --git a/gdcmPython/demo/CMakeLists.txt b/gdcmPython/demo/CMakeLists.txt index d6cc435a..93c5dd15 100644 --- a/gdcmPython/demo/CMakeLists.txt +++ b/gdcmPython/demo/CMakeLists.txt @@ -1,9 +1,11 @@ # Python testing directory, 'demo' is not very explicit ... +#----------------------------------------------------------------------------- # DOH! python is not found by default FIND_PROGRAM(PYTHON_EXECUTABLE - NAMES python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python + NAMES python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath] @@ -14,10 +16,20 @@ FIND_PROGRAM(PYTHON_EXECUTABLE MARK_AS_ADVANCED(PYTHON_EXECUTABLE) IF(PYTHON_EXECUTABLE) - ADD_TEST(PrintHeader-Python ${PYTHON_EXECUTABLE} + ADD_TEST(Python-PrintHeader ${PYTHON_EXECUTABLE} ${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintHeader.py ) ELSE(PYTHON_EXECUTABLE) MESSAGE(FATAL_ERROR "You requested testing for python, but python was not found") ENDIF(PYTHON_EXECUTABLE) + +#----------------------------------------------------------------------------- +# Copy all the demo directory content to the cmake bin +# Without it, tests can't be launched +CONFIGURE_FILE( + ${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintHeader.py + ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintHeader.py + COPYONLY +) + diff --git a/gdcmPython/gdcm.i b/gdcmPython/gdcm.i index 3daa580d..ee606d27 100644 --- a/gdcmPython/gdcm.i +++ b/gdcmPython/gdcm.i @@ -271,6 +271,7 @@ using namespace gdcm; %ignore gdcm::Header::Header(); %ignore gdcm::DicomDir::DicomDir(); +// Ignore all placed in gdcmCommon.h %ignore GDCM_UNKNOWN; %ignore GDCM_UNFOUND; %ignore GDCM_BINLOADED; diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index 34180075..9c3235c7 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.cxx,v $ Language: C++ - Date: $Date: 2005/01/08 15:03:59 $ - Version: $Revision: 1.61 $ + Date: $Date: 2005/01/12 15:23:44 $ + Version: $Revision: 1.62 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -65,8 +65,8 @@ Dict::Dict(std::string const &filename) } Filename = filename; + from.close(); } - from.close(); } /**