+### Sources section: determination of sources for the extensions:
+# Sources 1a/ The kernel of gdcm itself (which wrapped with Swig)
+# defines the first extension
+Sources = []
+Sources.extend(glob.glob(os.path.join(gdcmSrcDir,"*.cxx")))
+Sources.append(os.path.join(gdcmPythonSrcDir,"gdcm.i"))
+# Sources 1b/ The kernel of gdcm depends on a jpeg library whose sources are
+# contained in subdir gdcmJpeg8SrcDir. But within this subdir
+# some of the C files should not be compiled (refer to
+# gdcmJpeg8SrcDir/Makefile.am) !
+
+Jpeg8Sources = glob.glob(os.path.join(gdcmJpeg8SrcDir,"j*.c"))
+Jpeg8SourcesToRemove = ['jmemansi.c', 'jmemname.c', 'jmemdos.c', 'jmemmac.c']
+for Remove in Jpeg8SourcesToRemove:
+ ### Because setup.py is a multiple pass process we need to trap
+ ### the case where the files were allready wed out on a previous pass.
+ try:
+ Jpeg8Sources.remove(os.path.join(gdcmJpeg8SrcDir, Remove))
+ except ValueError:
+ continue
+Sources.extend(Jpeg8Sources)
+
+Jpeg12Sources = glob.glob(os.path.join(gdcmJpeg12SrcDir,"j*.c"))
+Jpeg12SourcesToRemove = ['jmemansi12.c', 'jmemname12.c', 'jmemdos12.c', 'jmemmac12.c']
+for Remove in Jpeg12SourcesToRemove:
+ ### Because setup.py is a multiple pass process we need to trap
+ ### the case where the files were allready wed out on a previous pass.
+ try:
+ Jpeg12Sources.remove(os.path.join(gdcmJpeg12SrcDir, Remove))
+ except ValueError:
+ continue
+Sources.extend(Jpeg12Sources)
+
+#For 'xmedcon' Jpeg Lossless
+JpgSources =glob.glob(os.path.join(gdcmJpgSrcDir,"*.c"))
+Sources.extend(JpgSources)
+
+# Sources 2/ The second extension contains the VTK classes (which we wrap
+# with the vtk wrappers):
+VTK_INCLUDE_DIR=os.path.join(VTKPATH,"include","vtk")
+VTK_LIB_DIR=os.path.join(VTKPATH,"lib","vtk")
+vtkSources = []
+vtkSources.extend(glob.glob(os.path.join(gdcmvtkSrcDir,"vtk*.cxx")))
+vtkSources.extend(glob.glob(os.path.join(gdcmSrcDir,"*.cxx")))
+vtkSources.extend(Jpeg8Sources)
+vtkSources.extend(Jpeg12Sources)
+vtkSources.extend(JpgSources)
+vtkSources.remove(os.path.join(gdcmvtkSrcDir,"vtkgdcmViewer.cxx"))
+
+vtkLibraries=["vtkCommon","vtkCommonPython",
+ "vtkIO","vtkIOPython",
+ "vtkFiltering","vtkFilteringPython"]
+
+#####