4 Installation script for the geniwrapper module
7 from distutils.core import setup, Extension
12 scripts = ['geni/gimport.py', 'geni/plc.py', 'cmdline/sfi.py', 'geni-config-tty']
13 package_dirs = ['geni', 'geni/util', 'geni/methods']
14 data_files = [('/etc/geni/', ['geni/aggregates.xml', 'geni/registries.xml', 'geni/util/geni_config', 'cmdline/configSfi.sh']),
15 ('/etc/init.d/', ['geni/geniwrapper'])]
16 symlinks = ['/usr/share/geniwrapper']
17 initscripts = ['/etc/init.d/geniwrapper']
19 if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']:
20 python_path = sys.path
21 site_packages_only = lambda path: path.endswith('site-packages')
22 site_packages_path = filter(site_packages_only, python_path)
23 add_geni_path = lambda path: path + os.sep + 'geni'
24 site_packages_path = map(add_geni_path, site_packages_path)
25 remove_dirs = ['/etc/geni/'] + site_packages_path
26 remove_files = ['/usr/bin/gimport.py', '/usr/bin/plc.py', '/usr/bin/sfi.py', '/usr/bin/geni-config-tty'] + \
27 symlinks + initscripts
30 for filepath in remove_files:
31 print "removing", filepath, "...",
35 except: print "failed"
37 for directory in remove_dirs:
38 print "removing", directory, "...",
40 shutil.rmtree(directory)
42 except: print "failed"
45 setup(name='geniwrapper',
47 packages = package_dirs,
48 data_files = data_files,
52 url = 'http://svn.planet-lab.org/svn/geniwrapper/',
53 description = "Geni API",
54 long_description = """\
55 Geniwrapper implements the Geni interface which serves
56 as a layer between the existing PlanetLab interfaces
61 # create symlink to geniwrapper source in /usr/share
62 python_path = sys.path
63 site_packages_only = lambda path: path.endswith('site-packages')
64 site_packages_path = filter(site_packages_only, python_path)
65 add_geni_path = lambda path: path + os.sep + 'geni'
66 site_packages_path = map(add_geni_path, site_packages_path)
67 # python path usualy has /urs/local/lib/ path , filter this out
68 site_packages_path = filter(lambda x: 'local' not in x, site_packages_path)
70 # we can not do this here as installation root might change paths
73 # for src in site_packages_path:
74 # for dst in symlinks:
76 # os.symlink(src, dst)
78 # for initscript in initscripts:
79 # os.chmod(initscript, 00744)