def remove_packages(module, port_path, packages):
 remove_c = 0
 for package in packages:
  if (not query_package(module, port_path, package)):
   continue
  (rc, out, err) = module.run_command(('%s uninstall %s' % (port_path, package)))
  if query_package(module, port_path, package):
   module.fail_json(msg=('failed to remove %s: %s' % (package, out)))
  remove_c += 1
 if (remove_c > 0):
  module.exit_json(changed=True, msg=('removed %s package(s)' % remove_c))
 module.exit_json(changed=False, msg='package(s) already absent')

def remove_packages ( module , port_path , packages ) : remove_c = 0 for package in packages : if ( not query_package ( module , port_path , package ) ) : continue ( rc , out , err ) = module . run_command ( ( '%s uninstall %s' % ( port_path , package ) ) ) if query_package ( module , port_path , package ) : module . fail_json ( msg = ( 'failed to remove %s: %s' % ( package , out ) ) ) remove_c += 1 if ( remove_c > 0 ) : module . exit_json ( changed = True , msg = ( 'removed %s package(s)' % remove_c ) ) module . exit_json ( changed = False , msg = 'package(s) already absent' )
uninstalls one or more packages if installed .