4 Installation script for the geniwrapper module
7 import sys, os, os.path
10 from distutils.core import setup
12 bins = [ 'config/sfa-config-tty',
13 'sfa/plc/sfa-import-plc.py',
14 'sfa/plc/sfa-nuke-plc.py',
15 'sfa/server/sfa-server.py',
17 'sfa/client/getNodes.py',
18 'sfa/client/getRecord.py',
19 'sfa/client/setRecord.py',
20 'sfa/client/genidump.py',
21 'sfatables/sfatables',
23 remove_bins = [ '/usr/bin/' + os.path.basename(bin) for bin in bins ]
25 package_dirs = [ 'sfa',
33 'sfa/rspecs/aggregates',
34 'sfa/rspecs/aggregates/vini',
37 'sfatables/processors',
40 data_files = [('/etc/sfa/', [ 'config/aggregates.xml',
41 'config/registries.xml',
43 'config/sfi_config']),
44 ('/etc/sfatables/matches/', glob('sfatables/matches/*')),
45 ('/etc/sfatables/targets/', glob('sfatables/targets/*')),
46 ('/etc/init.d/', ['sfa/init.d/sfa'])]
48 # add sfatables processors as data_files
49 processor_files = [f for f in glob('sfatables/processors/*') if os.path.isfile(f)]
50 data_files.append(('/etc/sfatables/processors/', processor_files))
51 processor_subdirs = [d for d in glob('sfatables/processors/*') if os.path.isdir(d)]
52 for d in processor_subdirs:
53 etc_dir = os.path.join("/etc/sfatables/processors", os.path.basename(d))
54 d_files = [f for f in glob(d + '/*') if os.path.isfile(f)]
55 data_files.append((etc_dir, processor_files))
57 initscripts = [ '/etc/init.d/sfa' ]
59 if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']:
60 python_path = sys.path
61 site_packages_path = [ path + os.sep + 'sfa' for path in python_path if path.endswith('site-packages')]
62 remove_dirs = ['/etc/sfa/'] + site_packages_path
63 remove_files = remove_bins + initscripts
66 for filepath in remove_files:
67 print "removing", filepath, "...",
71 except: print "failed"
73 for directory in remove_dirs:
74 print "removing", directory, "...",
76 shutil.rmtree(directory)
78 except: print "failed"
80 # avoid repeating what's in the specfile already
82 packages = package_dirs,
83 data_files = data_files,