]> Creatis software - gdcm.git/blob - gdcmPython/setup.py.in
525aa0c75633f81dff5b0157aaf123d23b8bd422
[gdcm.git] / gdcmPython / setup.py.in
1 #!/usr/bin/env python
2
3 """
4 setup.py for installing the gdcm-Python bindings using distutils.
5
6 Created by Mathieu Malaterre, May 2004.
7 Heavily based on setup.py.in from VTK, Prabhu Ramachandran, June 2002.
8
9 """
10
11 import glob, sys, os
12 from types import StringType
13 from distutils.core import setup
14 from distutils.util import change_root, convert_path
15 from distutils.command.install_data import install_data
16 from distutils.sysconfig import get_config_var
17
18 version = "${GDCM_VERSION}",
19
20 build_lib_dir = "${LIBRARY_OUTPUT_PATH}"
21
22 build_bin_dir = "${EXECUTABLE_OUTPUT_PATH}"
23
24 gdcmDictsDir = "${GDCM_SOURCE_DIR}"
25 gdcmDictsDir = os.path.join( gdcmDictsDir, "Dicts" )
26
27 # You can change this to suit your needs.  However you must make sure
28 # that under *nix the libvtk*Python*.so in the specified directory.
29 #install_lib_dir = "${CMAKE_INSTALL_PREFIX}/lib/vtk"
30
31 def get_libs():
32     """Returns a list of libraries to be installed.  """
33     libs = []
34     if os.name == 'posix':
35         libs = glob.glob(os.path.abspath(os.path.join(
36             build_lib_dir, '_gdcm' + get_config_var('SO'))))
37         libs = libs + glob.glob(os.path.abspath(os.path.join(
38             build_lib_dir, 'libvtkgdcmPython' + get_config_var('SO'))))
39     else:
40         d = os.path.normpath(build_lib_dir)
41         if not os.path.isfile(os.path.join(d, 'libvtkgdcmPython.dll')):
42             d = os.path.normpath(os.path.join(build_lib_dir, 'release'))
43             
44         libs = glob.glob(os.path.join(d, 'vtk*Python.dll'))
45
46     return libs
47
48 def get_scripts():
49     """Returns the appropriate gdcm.py python script
50     that is to be installed."""
51     scripts = []
52     if os.name == 'posix':
53         f = os.path.join(build_bin_dir, "gdcm.py")
54         if os.path.exists(f):
55             scripts.append(f)
56     else:
57         win32_bin_dir = build_bin_dir
58         for subdir in ('Debug', 'Release', 'MinSizeRel',
59                        'RelWithDebInfo'):
60             win32_bin_dir = os.path.join(build_bin_dir, subdir)
61             if os.path.exists(win32_bin_dir):
62                 break
63         for i in ('vtkpython.exe', 'pvtkpython.exe'):
64             f = os.path.join(os.path.normpath(win32_bin_dir), i)
65             if os.path.exists(f):
66                 scripts.append(f)
67     return scripts
68
69
70 print get_libs()
71 print get_scripts()
72 print gdcmDictsDir
73
74 """
75 setup(name="Distutils",
76       version="1.0",
77       description="Python Distribution Utilities",
78       author="Greg Ward",
79       author_email="gward@python.net",
80       url="http://www.python.org/sigs/distutils-sig/",
81       packages=['distutils', 'distutils.command'],
82      )
83
84 """
85 setup(name             = "gdcmPython",
86       version          = "${GDCM_VERSION}",
87       description      = "GNU DiCoM",
88       author           = "frog",
89       author_email     = "frog@creatis.insa-lyon.fr",
90       maintainer       = "GDCM Developers",
91       maintainer_email = "dcmlib@creatis.insa-lyon.fr",
92       license          = "LGPL",
93       long_description = "Library dedicated to reading/parsing and writing Dicom files",
94       url              = "http://www.creatis.insa-lyon.fr/Public/Gdcm/",
95       platforms        = ['Any'],
96       packages         = ['gdcmPython'],
97       #scripts          = get_scripts(),
98       #package_dir      = {'gdcmPython': '.'},
99       #data_files       = [ ('gdcmPython', 'gdcm.pth') ],
100      )
101
102       #data_files       = [('gdcmPython', get_libs()), ('gdcmPython', ['gdcm.pth'])]
103       #data_files       = [('Dicts', glob.glob(os.path.join(gdcmDictsDir,"Dicts/*"))) ]
104