4 Installation script for the sfa module
7 import sys, os, os.path
10 from distutils.core import setup
13 'config/sfa-config-tty',
14 'config/gen-sfa-cm-config.py',
15 'sfa/plc/sfa-import-plc.py',
16 'sfa/plc/sfa-nuke-plc.py',
17 'sfa/server/sfa-ca.py',
18 'sfa/server/sfa-server.py',
19 'sfa/server/sfa-clean-peer-records.py',
20 'sfa/server/sfa_component_setup.py',
22 'sfa/client/getNodes.py',
23 'sfa/client/getRecord.py',
24 'sfa/client/setRecord.py',
25 'sfa/client/sfadump.py',
26 'sfatables/sfatables',
39 'sfa/rspecs/aggregates',
42 'sfatables/processors',
46 data_files = [('/etc/sfa/', [ 'config/aggregates.xml',
47 'config/geni_aggregates.xml',
48 'config/registries.xml',
49 'config/default_config.xml',
51 'sfa/managers/pl/pl.rng']),
52 ('/etc/sfatables/matches/', glob('sfatables/matches/*.xml')),
53 ('/etc/sfatables/targets/', glob('sfatables/targets/*.xml')),
54 ('/etc/init.d/', ['sfa/init.d/sfa', 'sfa/init.d/sfa-cm'])]
56 # add sfatables processors as data_files
57 processor_files = [f for f in glob('sfatables/processors/*') if os.path.isfile(f)]
58 data_files.append(('/etc/sfatables/processors/', processor_files))
59 processor_subdirs = [d for d in glob('sfatables/processors/*') if os.path.isdir(d)]
60 for d in processor_subdirs:
61 etc_dir = os.path.join("/etc/sfatables/processors", os.path.basename(d))
62 d_files = [f for f in glob(d + '/*') if os.path.isfile(f)]
63 data_files.append((etc_dir, processor_files))
65 initscripts = [ '/etc/init.d/sfa', '/etc/init.d/sfa-cm' ]
67 if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']:
68 python_path = sys.path
69 site_packages_path = [ os.path.join(p,'sfa') for p in python_path if p.endswith('site-packages')]
70 site_packages_path += [ os.path.join(p,'sfatables') for p in python_path if p.endswith('site-packages')]
71 remove_dirs = ['/etc/sfa/', '/etc/sfatables'] + site_packages_path
72 remove_bins = [ '/usr/bin/' + os.path.basename(bin) for bin in bins ]
73 remove_files = remove_bins + initscripts
76 for filepath in remove_files:
77 print "removing", filepath, "...",
81 except: print "failed"
83 for directory in remove_dirs:
84 print "removing", directory, "...",
86 shutil.rmtree(directory)
88 except: print "failed"
90 # avoid repeating what's in the specfile already
92 packages = package_dirs,
93 data_files = data_files,