code: def update_dependency(self, tile, depinfo, destdir=None):
          
  
          if destdir is None:
              destdir = os.path.join(tile.folder, 'build', 'deps', depinfo['unique_id'])
  
          has_version = False
          had_version = False
          if os.path.exists(destdir):
              has_version = True
              had_version = True
  
          for priority, rule in self.rules:
              if not self._check_rule(rule, depinfo):
                  continue
  
              resolver = self._find_resolver(rule)
  
              if has_version:
                  deptile = IOTile(destdir)
  
                  # If the dependency is not up to date, don't do anything
                  depstatus = self._check_dep(depinfo, deptile, resolver)
                  if depstatus is False:
                      shutil.rmtree(destdir)
                      has_version = False
                  else:
                      continue
  
              # Now try to resolve this dependency with the latest version
              result = resolver.resolve(depinfo, destdir)
              if not result['found'] and result.get('stop', False):
                  return 'not found'
  
              if not result['found']:
                  continue
  
              settings = {
                  'resolver': resolver.__class__.__name__,
                  'factory_args': rule[2]
              }
  
              if 'settings' in result:
                  settings['settings'] = result['settings']
  
              self._save_depsettings(destdir, settings)
  
              if had_version:
                  return "updated"
  
              return "installed"
  
          if has_version:
              return "already installed"
  
          return "not found"
docs: Attempt to install or update a dependency to the latest version.
  
          Args:
              tile (IOTile): An IOTile object describing the tile that has the dependency
              depinfo (dict): a dictionary from tile.dependencies specifying the dependency
              destdir (string): An optional folder into which to unpack the dependency
  
          Returns:
              string: a string indicating the outcome.  Possible values are:
                  "already installed"
                  "installed"
                  "updated"
                  "not found"