0

So writing a fabfile function, I attempt to automate the setup of a particular mac os x machine like this.

from fabric.api import local, env, sudo, require

def mac_port_setup():
    PACKAGES = ['vim +python27', 'htop']
    for item in PACKAGES:
        local('sudo port -v install {0}'.format(item))

The PACKAGES list can actually be a huge list and I want to avoid installing a package if the package is already installed. What are the possible ways to go about preventing an already installed package from being re-installed in my fabric automation?

Calvin Cheng
  • 35,640
  • 39
  • 116
  • 167

1 Answers1

0

Pretty sure running the install again won't do anything on already installed packages. If you want to check first port has the installed command to list what's been installed.

Morgan
  • 4,143
  • 27
  • 35