]> Creatis software - gdcm.git/commitdiff
* Bug fix for the python part use
authorregrain <regrain>
Wed, 12 Jan 2005 15:23:43 +0000 (15:23 +0000)
committerregrain <regrain>
Wed, 12 Jan 2005 15:23:43 +0000 (15:23 +0000)
   -- BeNours

ChangeLog
gdcmPython/CMakeLists.txt
gdcmPython/demo/CMakeLists.txt
gdcmPython/gdcm.i
src/gdcmDict.cxx

index 86e8643a98dbbdea4aa8696890b42beb8588da28..dea2eff9a45f2af0727fc7a60826e3fd8e97b806 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2005-01-11 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+   * Bug fix for the python part use
+   
 2005-01-11 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * gdcmPython/gdcm.i : bug fix when compiling with MSCV
 
index 04a30511a219ad8b7e494b3c942f83e387d3bf2a..b6f7322beb1d832fd486b3495a567a94bf8556af 100644 (file)
@@ -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:
 
index d6cc435a9a4059ffb9f35462be9dd9198b91a80c..93c5dd15f3758fd4c99da3ce7e2c69cef060dc82 100644 (file)
@@ -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
+)
+
index 3daa580d0fdab3a56e139cf71b0044651b4a039c..ee606d27ea46695ac531f34a777da2d36623e55f 100644 (file)
@@ -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;
index 34180075979fb881bcfd5d248715c0213e98327e..9c3235c78aecf84bf549034b05653de9058ba1d6 100644 (file)
@@ -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();
 }
 
 /**