Killed reference to pdb
[sfa.git] / setup.py
1 #!/usr/bin/python
2
3 """
4 Installation script for the geniwrapper module
5 """
6
7 import os, sys
8 import shutil
9 from distutils.core import setup
10
11 scripts = [ 'config/sfa-config-tty',
12             'sfa/plc/sfa-import-plc.py', 
13             'sfa/server/sfa-server.py', 
14             'sfa/client/sfi.py', 
15             'sfa/client/getNodes.py',
16             'sfa/client/getRecord.py',
17             'sfa/client/setRecord.py',
18             'sfa/client/genidump.py',
19             ]
20 package_dirs = [ 'sfa', 
21                  'sfa/client',
22                  'sfa/methods',
23                  'sfa/plc',
24                  'sfa/server',
25                  'sfa/trust',
26                  'sfa/util', 
27                  ]
28 data_files = [ ('/etc/sfa/', [ 'config/aggregates.xml', 
29                                'config/registries.xml', 
30                                'config/sfa_config', 
31                                'config/sfi_config',
32                                ]),
33                ('/etc/init.d/', ['sfa/init.d/sfa']),
34                ]
35 initscripts = [ '/etc/init.d/sfa' ]
36         
37 if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']:
38     python_path = sys.path
39     site_packages_path = [ path + os.sep + 'sfa' for path in python_path if path.endswith('site-packages')]
40     remove_dirs = ['/etc/sfa/'] + site_packages_path
41     remove_files = [ '/usr/bin/sfa-config-tty',
42                      '/usr/bin/sfa-import-plc.py', 
43                      '/usr/bin/sfa-nuke-plc.py', 
44                      '/usr/bin/sfa-server.py', 
45                      '/usr/bin/sfi.py', 
46                      '/usr/bin/getNodes.py',
47                      '/usr/bin/getRecord.py',
48                      '/usr/bin/setRecord.py',
49                      '/usr/bin/genidump.py',
50                     ] + initscripts
51     
52     # remove files   
53     for filepath in remove_files:
54         print "removing", filepath, "...",
55         try: 
56             os.remove(filepath)
57             print "success"
58         except: print "failed"
59     # remove directories 
60     for directory in remove_dirs: 
61         print "removing", directory, "...",
62         try: 
63             shutil.rmtree(directory)
64             print "success"
65         except: print "failed"
66  
67 else:
68     
69     # avoid repeating what's in the specfile already
70     setup(name='sfa',
71           packages = package_dirs, 
72           data_files = data_files,
73           ext_modules = [],
74           py_modules = [],
75           scripts = scripts,   
76           )
77