$search
00001 #!/usr/bin/python 00002 00003 #based on script for SCALA see https://github.com/scala-ide/scala-ide 00004 #ported to python an adapted for BRIDE 00005 00006 import roslib 00007 import os 00008 import sys 00009 import subprocess 00010 import yaml 00011 00012 eclipse_app = "org.eclipse.equinox.p2.director" 00013 eclipse_opts = "-nosplash" 00014 00015 def install(eclipse_repo, eclipse_component): 00016 p = subprocess.Popen("./eclipse/eclipse " + eclipse_opts + " -application " + eclipse_app + " -repository " + eclipse_repo + " -installIU " + eclipse_component, shell=True) 00017 sts = os.waitpid(p.pid, 0)[1] 00018 00019 def uninstall(eclipse_repo, eclipse_component): 00020 p = subprocess.Popen("./eclipse/eclipse " + eclipse_opts + " -application " + eclipse_app + " -repository " + eclipse_repo + " -uninstallIU " + eclipse_component, shell=True) 00021 sts = os.waitpid(p.pid, 0)[1] 00022 00023 def update(eclipse_repo, eclipse_component): 00024 p = subprocess.Popen("./eclipse/eclipse " + eclipse_opts + " -application " + eclipse_app + " -repository " + eclipse_repo + " -installIU " + eclipse_component + " -uninstallIU " + eclipse_component, shell=True) 00025 sts = os.waitpid(p.pid, 0)[1] 00026 00027 00028 def install_emfatic(): 00029 eclipse_repo = "http://download.eclipse.org/emfatic/update/" 00030 eclipse_repo = "http://download.eclipse.org/epsilon/updates/" 00031 eclipse_component = "org.eclipse.emf.emfatic" 00032 eclipse_component = "org.eclipse.epsilon.feature.feature" 00033 install(eclipse_repo, eclipse_component) 00034 00035 if __name__ == "__main__": 00036 if(len(sys.argv) == 2): 00037 stream = file(sys.argv[1], 'r') 00038 toinstall = yaml.load(stream) 00039 for repo in toinstall: 00040 for package in toinstall[repo]: 00041 install(repo, package) 00042 elif(len(sys.argv) == 3): 00043 if(sys.argv[1] == '-u'): 00044 stream = file(sys.argv[2], 'r') 00045 toinstall = yaml.load(stream) 00046 for repo in toinstall: 00047 for package in toinstall[repo]: 00048 update(repo, package) 00049 else: 00050 print "Usage: installer.py [-u] resource_yaml_file" 00051 else: 00052 print "Usage: installer.py [-u] resource_yaml_file" 00053