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',
34 'sfa/rspecs/aggregates',
35 'sfa/rspecs/aggregates/vini',
38 'sfatables/processors',
42 data_files = [('/etc/sfa/', [ 'config/aggregates.xml',
43 'config/registries.xml',
45 'config/sfi_config']),
46 ('/etc/sfatables/matches/', glob('sfatables/matches/*.xml')),
47 ('/etc/sfatables/targets/', glob('sfatables/targets/*.xml')),
48 ('/etc/init.d/', ['sfa/init.d/sfa'])]
50 # add sfatables processors as data_files
51 processor_files = [f for f in glob('sfatables/processors/*') if os.path.isfile(f)]
52 data_files.append(('/etc/sfatables/processors/', processor_files))
53 processor_subdirs = [d for d in glob('sfatables/processors/*') if os.path.isdir(d)]
54 for d in processor_subdirs:
55 etc_dir = os.path.join("/etc/sfatables/processors", os.path.basename(d))
56 d_files = [f for f in glob(d + '/*') if os.path.isfile(f)]
57 data_files.append((etc_dir, processor_files))
59 initscripts = [ '/etc/init.d/sfa' ]
61 if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']:
62 python_path = sys.path
63 site_packages_path = [ os.path.join(p,'sfa') for p in python_path if p.endswith('site-packages')]
64 site_packages_path += [ os.path.join(p,'sfatables') for p in python_path if p.endswith('site-packages')]
65 remove_dirs = ['/etc/sfa/', '/etc/sfatables'] + site_packages_path
66 remove_bins = [ '/usr/bin/' + os.path.basename(bin) for bin in bins ]
67 remove_files = remove_bins + initscripts
70 for filepath in remove_files:
71 print "removing", filepath, "...",
75 except: print "failed"
77 for directory in remove_dirs:
78 print "removing", directory, "...",
80 shutil.rmtree(directory)
82 except: print "failed"
84 # avoid repeating what's in the specfile already
86 packages = package_dirs,
87 data_files = data_files,