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',
16 'sfa/server/sfa-clean-peer-records.py',
18 'sfa/client/getNodes.py',
19 'sfa/client/getRecord.py',
20 'sfa/client/setRecord.py',
21 'sfa/client/genidump.py',
22 'sfatables/sfatables',
25 package_dirs = [ 'sfa',
33 'sfa/rspecs/aggregates',
34 'sfa/rspecs/aggregates/vini',
37 'sfatables/processors',
41 data_files = [('/etc/sfa/', [ 'config/aggregates.xml',
42 'config/registries.xml',
44 'config/sfi_config']),
45 ('/etc/sfatables/matches/', glob('sfatables/matches/*.xml')),
46 ('/etc/sfatables/targets/', glob('sfatables/targets/*.xml')),
47 ('/etc/init.d/', ['sfa/init.d/sfa'])]
49 # add sfatables processors as data_files
50 processor_files = [f for f in glob('sfatables/processors/*') if os.path.isfile(f)]
51 data_files.append(('/etc/sfatables/processors/', processor_files))
52 processor_subdirs = [d for d in glob('sfatables/processors/*') if os.path.isdir(d)]
53 for d in processor_subdirs:
54 etc_dir = os.path.join("/etc/sfatables/processors", os.path.basename(d))
55 d_files = [f for f in glob(d + '/*') if os.path.isfile(f)]
56 data_files.append((etc_dir, processor_files))
58 initscripts = [ '/etc/init.d/sfa' ]
60 if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']:
61 python_path = sys.path
62 site_packages_path = [ os.path.join(p,'sfa') for p in python_path if p.endswith('site-packages')]
63 site_packages_path += [ os.path.join(p,'sfatables') for p in python_path if p.endswith('site-packages')]
64 remove_dirs = ['/etc/sfa/', '/etc/sfatables'] + site_packages_path
65 remove_bins = [ '/usr/bin/' + os.path.basename(bin) for bin in bins ]
66 remove_files = remove_bins + initscripts
69 for filepath in remove_files:
70 print "removing", filepath, "...",
74 except: print "failed"
76 for directory in remove_dirs:
77 print "removing", directory, "...",
79 shutil.rmtree(directory)
81 except: print "failed"
83 # avoid repeating what's in the specfile already
85 packages = package_dirs,
86 data_files = data_files,