Check and display upgraded packages
508241
def check_updates():
    
    count, packages = fetch()
    message = "No news is good news !"
    if count > 0:
        message = ("{0} software updates are available\n".format(count))
    return [message, count, packages]
504209
public function actionUpdate()
	{
		Output::line('Getting package info...');
		\App::$domain->vendor->package->versionUpdate();
		Output::block('Packages version updated');
	}
1356903
def upgrade_packages():
    
    if env.verbosity:
        print env.host, "apt-get UPDATING and UPGRADING SERVER PACKAGES"
        print " * running apt-get update "
    sudo('apt-get -qqy update')
    if env.verbosity:
        print " * running apt-get upgrade"
        print " NOTE: apt-get upgrade has been known in rare cases to require user input."
        print "If apt-get upgrade does not complete within 15 minutes"
        print "see troubleshooting docs *before* aborting the process to avoid package management corruption."
    sudo('apt-get -qqy upgrade')
1335250
def get():
    """"""
    pkgnames = find_packages()

    if len(pkgnames) == 0:
        raise ValueError("Can't find any packages")

    pkgname = pkgnames[0]

    content = open(join(pkgname, '__init__.py')).read()
    c = re.compile(r"__version__ *= *('[^']+'|\"[^\"]+\")")
    m = c.search(content)

    if m is None:
        raise ValueError("Can't find __version__ = ... in __init__.py")

    return m.groups()[0][1: -1]
1204782
def check_dependencies():
    

    # Check that git is installed
    if not shutil.which("git"):
        raise Error(_("You don't have git. Install git, then re-run!"))

    # Check that git --version > 2.7
    version = subprocess.check_output(["git", "--version"]).decode("utf-8")
    matches = re.search(r"^git version (\d+\.\d+\.\d+).*$", version)
    if not matches or pkg_resources.parse_version(matches.group(1)) < pkg_resources.parse_version("2.7.0"):
        raise Error(_("You have an old version of git. Install version 2.7 or later, then re-run!"))
1255233
async def packages(
            self, package_state: Union[int, str] = '',
            show_archived: bool = False) -> list:
        """"""
        packages_resp = await self._request(
            'post',
            API_URL_BUYER,
            json={
                'version': '1.0',
                'method': 'GetTrackInfoList',
                'param': {
                    'IsArchived': show_archived,
                    'Item': '',
                    'Page': 1,
                    'PerPage': 40,
                    'PackageState': package_state,
                    'Sequence': '0'
                },
                'sourcetype': 0
            })

        _LOGGER.debug('Packages response: %s', packages_resp)

        packages = []
        for package in packages_resp.get('Json', []):
            last_event = package.get('FLastEvent')
            if last_event:
                event = json.loads(last_event)
            else:
                event = {}

            kwargs = {
                'destination_country': package.get('FSecondCountry', 0),
                'friendly_name': package.get('FRemark'),
                'info_text': event.get('z'),
                'location': event.get('c'),
                'origin_country': package.get('FFirstCountry', 0),
                'package_type': package.get('FTrackStateType', 0),
                'status': package.get('FPackageState', 0)
            }
            packages.append(Package(package['FTrackNo'], **kwargs))
        return packages
423824
function ShowVersion(packageJson) {
  const pkgName = packageJson.name;
  let latestVer = spawnSync(`npm show ${pkgName} version`, {
    shell: true,
    stdio: ['inherit', 'pipe', 'inherit'],
  }).stdout;

  let latestVerStr = '';
  if (latestVer) {
    latestVer = latestVer.toString('utf-8').replace(/\s/gm, '');
    if (latestVer !== packageJson.version) {
      const osType = os.type();
      const sudo = (osType === 'Linux' || osType === 'Darwin') ? 'sudo ' : '';
      latestVerStr = `Latest version on npm: ${col.warning(latestVer).bold}
Run "${col.warning(`${sudo}npm install -g ${pkgName}@latest`)}" to upgrade.`;
    } else {
      latestVerStr = `${col.success('up-to-date!')}`;
    }
  }
  return `${packageJson.version}\n${latestVerStr}`;
}
117807
def upgrade_available(name):
    '''
    
    '''
    version_num = None
    cmd = '/opt/csw/bin/pkgutil -c --parse --single {0}'.format(
        name)
    out = __salt__['cmd.run_stdout'](cmd)
    if out:
        version_num = out.split()[2].strip()
    if version_num:
        if version_num == "SAME":
            return ''
        else:
            return version_num
    return ''
267990
def upgrade(self):
        
        for pkg in self.upgrade_all:
            check_md5(pkg_checksum(pkg, "slack_patches"), self.patch_path + pkg)
            pkg_ver = "{0}-{1}".format(split_package(pkg)[0],
                                       split_package(pkg)[1])
            if find_package(split_package(pkg)[0] + self.meta.sp,
                            self.meta.pkg_path):
                print("[ {0}upgrading{1} ] --> {2}".format(
                    self.meta.color["YELLOW"], self.meta.color["ENDC"],
                    pkg[:-4]))
                PackageManager((self.patch_path + pkg).split()).upgrade(
                    "--install-new")
                self.upgraded.append(pkg_ver)
            else:
                print("[ {0}installing{1} ] --> {2}".format(
                    self.meta.color["GREEN"], self.meta.color["ENDC"],
                    pkg[:-4]))
                PackageManager((self.patch_path + pkg).split()).upgrade(
                    "--install-new")
                self.installed.append(pkg_ver)
335980
def find_installed_packages(self):
        
        list_command = subprocess.Popen(self.list_command, shell=True, stdout=subprocess.PIPE)
        stdout, stderr = list_command.communicate()
        if list_command.returncode != 0:
            raise SystemDependencyError("The command to list the installed system packages failed! ({command})",
                                        command=self.list_command)
        installed_packages = sorted(stdout.decode().split())
        logger.debug("Found %i installed system package(s): %s", len(installed_packages), installed_packages)
        return installed_packages
46471
def display(self):
        
        for pkg in self.binary:
            name = GetFromInstalled(pkg).name()
            ver = GetFromInstalled(pkg).version()
            find = find_package("{0}{1}{2}".format(name, ver, self.meta.sp),
                                self.meta.pkg_path)
            if find:
                package = Utils().read_file(
                    self.meta.pkg_path + "".join(find))
                print(package)
            else:
                message = "Can't dislpay"
                if len(self.binary) > 1:
                    bol = eol = ""
                else:
                    bol = eol = "\n"
                self.msg.pkg_not_found(bol, pkg, message, eol)
                raise SystemExit(1)
380555
def sbo_upgrade(skip, flag):
    
    Msg().checking()
    upgrade_names = []
    data = SBoGrep(name="").names()
    blacklist = BlackList().packages(pkgs=data, repo="sbo")
    for pkg in sbo_list():
        status(0.02)
        name = split_package(pkg)[0]
        ver = split_package(pkg)[1]
        if (name in data and name not in skip and name not in blacklist):
            sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
            package = ("{0}-{1}".format(name, ver))
            if LooseVersion(sbo_package) > LooseVersion(package):
                upgrade_names.append(name)
    Msg().done()
    if "--checklist" in flag:
        upgrade_names = choose_upg(upgrade_names)
    return upgrade_names
981274
def checkInstalledBrew(package, similar=True, speak=True, speakSimilar=True):
    """"""
    packages = subprocess.check_output(['brew', 'list']).split()
    installed = package in packages
    similar = []

    if not installed:
        similar = [pkg for pkg in packages if package in pkg]
    if speak:
        speakInstalledPackages(package, "homebrew", installed, similar, speakSimilar)

    return (installed, similar)
894605
def versions_installed(pkg):
    '''
    
    '''

    try:
        # Try to run it, merging stderr into output
        output = subprocess.check_output([SNAP_BINARY_NAME, 'list', pkg], stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError:
        return []

    lines = output.splitlines()[1:]
    ret = []
    for item in lines:
        # If fields contain spaces this will break.
        i = item.split()
        # Ignore 'Notes' field
        ret.append({
            'name':         i[0],
            'version':      i[1],
            'rev':          i[2],
            'tracking':     i[3],
            'publisher':    i[4]
            })

    return ret
1113891
def applied():
    """"""
    upgrader = InvenioUpgrader()
    logger = upgrader.get_logger()

    try:
        upgrades = upgrader.get_history()

        if not upgrades:
            logger.info("No upgrades have been applied.")
            return

        logger.info("Following upgrade(s) have been applied:")

        for u_id, applied in upgrades:
            logger.info(" * %s (%s)" % (u_id, applied))
    except RuntimeError as e:
        for msg in e.args:
            logger.error(unicode(msg))
        raise
1309070
def is_outdated(self):
        """"""
        if self.args.disable_check_update:
            # Check is disabled by configuration
            return False

        logger.debug("Check Glances version (installed: {} / latest: {})".format(self.installed_version(), self.latest_version()))
        return LooseVersion(self.latest_version()) > LooseVersion(self.installed_version())
89228
def install_packages(self):
        
        installs, upgraded = [], []
        for inst in (self.dep_install + self.install):
            package = (self.tmp_path + inst).split()
            pkg_ver = "{0}-{1}".format(split_package(inst)[0],
                                       split_package(inst)[1])
            self.checksums(inst)
            if GetFromInstalled(split_package(inst)[0]).name():
                print("[ {0}upgrading{1} ] --> {2}".format(
                    self.meta.color["YELLOW"], self.meta.color["ENDC"], inst))
                upgraded.append(pkg_ver)
                if "--reinstall" in self.flag:
                    PackageManager(package).upgrade("--reinstall")
                else:
                    PackageManager(package).upgrade("--install-new")
            else:
                print("[ {0}installing{1} ] --> {2}".format(
                    self.meta.color["GREEN"], self.meta.color["ENDC"], inst))
                installs.append(pkg_ver)
                PackageManager(package).upgrade("--install-new")
        return [installs, upgraded]