예제 #1
0
def linux_fedora_install(package_name):
    qt = has_qt()
    hide_splash_if_necessary()
    if qt:
        cmd = core.system.vistrails_root_directory()
        cmd += '/core/bundles/linux_fedora_install.py'
    else:
        cmd = 'yum -y install'

    if type(package_name) == str:
        cmd += ' ' + package_name
    elif type(package_name) == list:
        for package in package_name:
            if type(package) != str:
                raise TypeError("Expected string or list of strings")
            cmd += ' ' + package

    if qt:
        sucmd = guess_graphical_sudo() + " " + cmd
    else:
        print ("VisTrails wants to install package(s) '%s' through _sudo_. Make sure" +
               " you are a sudoer.") % package_name
        sucmd = "sudo " + cmd

    print sucmd
    result = os.system(sucmd)
    print "RETURN VALUE", result
    return (result == 0)
예제 #2
0
def linux_ubuntu_install(package_name):
    qt = has_qt()
    hide_splash_if_necessary()
        
    if qt:
        cmd = core.system.vistrails_root_directory()
        cmd += '/core/bundles/linux_ubuntu_install.py'
    else:
        cmd = 'apt-get install -y'

    if type(package_name) == str:
        cmd += ' ' + package_name
    elif type(package_name) == list:
        for package in package_name:
            if type(package) != str:
                raise TypeError("Expected string or list of strings")
            cmd += ' ' + package

    if qt:
        sucmd = guess_graphical_sudo() + " '" + cmd + "'"
    else:
        print "VisTrails wants to install package(s) '%s'" % package_name
        sucmd = "sudo " + cmd

    result = os.system(sucmd)

    return (result == 0) # 0 indicates success