4 Installation script for the sfa module
7 # as fas as pushing onto pypi, I have been using this page
8 # http://peterdowns.com/posts/first-time-with-pypi.html
9 # for setting up the whole business
11 import sys, os, os.path
14 from distutils.core import setup
16 # while cleaning up we might not have this..
18 from sfa.util.version import version_tag
20 version_tag='cleaningup'
22 scripts = glob("clientbin/*.py") + \
24 'config/sfa-config-tty',
26 # 'config/gen-sfa-cm-config.py',
27 'sfa/server/sfa-start.py',
28 # 'sfa/server/sfa_component_setup.py',
29 'sfatables/sfatables',
30 'keyconvert/keyconvert.py',
31 'flashpolicy/sfa_flashpolicy.py',
45 'sfa/rspecs/elements',
46 'sfa/rspecs/elements/versions',
47 'sfa/rspecs/versions',
58 'sfatables/processors',
61 initscripts = [ 'sfa' ]
62 if not os.path.isfile('/etc/redhat-release'): initscripts.append('functions.sfa')
64 data_files = [ ('/etc/sfa/', [ 'config/aggregates.xml',
65 'config/registries.xml',
66 'config/default_config.xml',
67 'config/api_versions.xml',
70 'sfa/managers/pl/pl.rng',
71 'sfa/trust/credential.xsd',
75 'sfa/trust/protogeni-rspec-common.xsd',
76 'flashpolicy/sfa_flashpolicy_config.xml',
78 ('/etc/sfatables/matches/', glob('sfatables/matches/*.xml')),
79 ('/etc/sfatables/targets/', glob('sfatables/targets/*.xml')),
80 ('/etc/init.d/', [ "init.d/%s"%x for x in initscripts ]),
81 ('/usr/share/sfa/migrations', glob('sfa/storage/migrations/*.*') ),
82 ('/usr/share/sfa/migrations/versions', glob('sfa/storage/migrations/versions/*') ),
83 ('/usr/share/sfa/examples/', glob('sfa/examples/*' ) + [ 'cron.d/sfa.cron' ] ),
86 # add sfatables processors as data_files
87 processor_files = [f for f in glob('sfatables/processors/*') if os.path.isfile(f)]
88 data_files.append(('/etc/sfatables/processors/', processor_files))
89 processor_subdirs = [d for d in glob('sfatables/processors/*') if os.path.isdir(d)]
90 for d in processor_subdirs:
91 etc_dir = os.path.join("/etc/sfatables/processors", os.path.basename(d))
92 d_files = [f for f in glob(d + '/*') if os.path.isfile(f)]
93 data_files.append((etc_dir, processor_files))
95 if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']:
96 python_path = sys.path
97 site_packages_path = [ os.path.join(p,'sfa') for p in python_path if p.endswith('site-packages')]
98 site_packages_path += [ os.path.join(p,'sfatables') for p in python_path if p.endswith('site-packages')]
99 remove_dirs = ['/etc/sfa/', '/etc/sfatables'] + site_packages_path
100 remove_bins = [ '/usr/bin/' + os.path.basename(bin) for bin in scripts ]
101 remove_files = remove_bins + [ "/etc/init.d/%s"%x for x in initscripts ]
104 for filepath in remove_files:
105 print "removing", filepath, "...",
109 except: print "failed"
111 for directory in remove_dirs:
112 print "removing", directory, "...",
114 shutil.rmtree(directory)
116 except: print "failed"
118 # avoid repeating what's in the specfile already
121 data_files = data_files,
123 keywords = ['federation','testbeds','SFA','SfaWrap'],
124 url="http://svn.planet-lab.org/wiki/SFATutorial",
125 author="Thierry Parmentelat, Tony Mack, Scott Baker",
126 author_email="thierry.parmentelat@inria.fr, tmack@princeton.cs.edu, smbaker@gmail.com",
127 download_url = "http://build.onelab.eu/sfa/{v}/sfa-{v}.tar.gz".format(v=version_tag),