List files for an installed package
964784
def list_packages(conn=None):
    '''
    
    '''
    close = False
    if conn is None:
        close = True
        conn = init()

    ret = []
    data = conn.execute('SELECT package FROM packages')
    for pkg in data.fetchall():
        ret.append(pkg)

    if close:
        conn.close()
    return ret
893350
def cmd_list(unused_conf: Config):
    """"""
    for name, builder in sorted(Plugin.builders.items()):
        if builder.func:
            print('+- {0:16s} implemented in {1.__module__}.{1.__name__}()'
                  .format(name, builder.func))
        else:
            print('+- {0:16s} loaded with no builder function'.format(name))
        for hook_name, hook_func in sorted(Plugin.get_hooks_for_builder(name)):
            print('  +- {0} hook implemented in '
                  '{1.__module__}.{1.__name__}()'
                  .format(hook_name, hook_func))
900109
def _get_paths(self):
        """"""
        ret = []
        ret += ['%s/library/' % os.path.dirname(os.path.dirname(__file__))]        
        
        ret += self._extra_dirs
        for basedir in _basedirs:
            fullpath = os.path.join(basedir, self.subdir)
            if fullpath not in ret:
                ret.append(fullpath)
        ret += self.config.split(os.pathsep)
        ret += self._get_package_path()
        return ret
115210
def list_installed():
    '''
    
    '''
    result = __salt__['pkg.version'](_package_name(), versions_as_list=True)
    if result is None:
        return []

    if six.PY2:
        return sorted(result, cmp=_cmp_version)
    else:
        return sorted(result, key=functools.cmp_to_key(_cmp_version))
1280924
def list_files(path, extension=".cpp", exclude="S.cpp"):
    """"""
    return ["%s/%s" % (path, f) for f in listdir(path) if f.endswith(extension) and (not f.endswith(exclude))]
514282
def filenames(self):
        """"""
        return [p.name for p in self.packets if isinstance(p, FileDescriptionPacket)]
1282078
def list_lib(self, repo):
        
        packages = ""
        if repo == "sbo":
            if (os.path.isfile(
                    self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(
                        repo))):
                packages = Utils().read_file(self.meta.lib_path + "{0}_repo/"
                                             "SLACKBUILDS.TXT".format(repo))
        else:
            if (os.path.isfile(
                    self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format(repo))):
                packages = Utils().read_file(self.meta.lib_path + "{0}_repo/"
                                             "PACKAGES.TXT".format(repo))
        return packages
1057962
def package_list(self, repo, name, INDEX, installed):
        
        tty_size = os.popen("stty size", "r").read().split()
        row = int(tty_size[0]) - 2
        try:
            all_installed_names = []
            index, page, pkg_list = 0, row, []
            r = self.list_lib(repo)
            pkg_list = self.list_greps(repo, r)[0]
            all_installed_names = self.list_of_installed(repo, name)
            print("")
            for pkg in sorted(pkg_list):
                pkg = self._splitting_packages(pkg, repo, name)
                if installed:
                    if repo == "sbo":
                        if pkg in all_installed_names:
                            pkg = ("{0}{1}{2}".format(self.meta.color["GREEN"],
                                                      pkg,
                                                      self.meta.color["ENDC"]))
                    else:
                        if pkg in all_installed_names:
                            pkg = ("{0}{1}{2}".format(self.meta.color["GREEN"],
                                                      pkg,
                                                      self.meta.color["ENDC"]))
                if INDEX:
                    index += 1
                    pkg = self.list_color_tag(pkg)
                    print("{0}{1}:{2} {3}".format(
                        self.meta.color["GREY"], index,
                        self.meta.color["ENDC"], pkg))
                    if index == page:
                        read = raw_input("\nPress {0}Enter{1} to "
                                         "continue... ".format(
                                             self.meta.color["CYAN"],
                                             self.meta.color["ENDC"]))
                        if read in ["Q", "q"]:
                            break
                        print("")   # new line after page
                        page += row
                else:
                    print(pkg)
            print("")   # new line at end
        except EOFError:
            print("")   # new line at exit
            raise SystemExit()
968997
def FindInstalledFiles(self):
        
        from SCons.Tool import install
        if install._UNIQUE_INSTALLED_FILES is None:
            install._UNIQUE_INSTALLED_FILES = SCons.Util.uniquer_hashables(install._INSTALLED_FILES)
        return install._UNIQUE_INSTALLED_FILES
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
199994
def _get_installed(self):
        
        from utility import get_json
        #This is a little tricky because the data file doesn't just have a list
        #of installed servers. It also manages the script's database that tracks
        #the user's interactions with it.
        fulldata = get_json(self.instpath, {})
        if "installed" in fulldata:
            return fulldata["installed"]
        else:
            return []
760595
def list_downloaded(**kwargs):
    '''
    
    '''
    CACHE_DIR = os.path.join('/var/cache/', _yum())

    ret = {}
    for root, dirnames, filenames in salt.utils.path.os_walk(CACHE_DIR):
        for filename in fnmatch.filter(filenames, '*.rpm'):
            package_path = os.path.join(root, filename)
            pkg_info = __salt__['lowpkg.bin_pkg_info'](package_path)
            pkg_timestamp = int(os.path.getctime(package_path))
            ret.setdefault(pkg_info['name'], {})[pkg_info['version']] = {
                'path': package_path,
                'size': os.path.getsize(package_path),
                'creation_date_time_t': pkg_timestamp,
                'creation_date_time': datetime.datetime.fromtimestamp(pkg_timestamp).isoformat(),
            }
    return ret
308693
def data(self):
        
        for pkg in self.installed:
            if os.path.isfile(self.meta.pkg_path + pkg):
                name = split_package(pkg)[0]
                for log in self.logs:
                    deps = Utils().read_file(self.dep_path + log)
                    for dep in deps.splitlines():
                        if name == dep:
                            if name not in self.dmap.keys():
                                self.dmap[name] = [log]
                                if not self.count_pkg:
                                    self.count_pkg = 1
                            else:
                                self.dmap[name] += [log]
        self.count_packages()
734605
def list_installed():
    '''
    
    '''
    cmd = 'Get-WindowsFeature ' \
          '-ErrorAction SilentlyContinue ' \
          '-WarningAction SilentlyContinue ' \
          '| Select DisplayName,Name,Installed'
    features = _pshell_json(cmd)

    ret = {}
    for entry in features:
        if entry['Installed']:
            ret[entry['Name']] = entry['DisplayName']

    return ret
344364
def _view_deps(self, path, package):
        
        self.size = 0
        packages = []
        dependencies = (Utils().read_file(path + package)).splitlines()
        for dep in dependencies:
            if GetFromInstalled(dep).name():
                ver = GetFromInstalled(dep).version()
                packages.append(dep + ver)
            else:
                dependencies.remove(dep)
        if packages:
            if "--checklist" in self.extra:
                deps, dependencies = [], []
                text = "Found dependencies for the package {0}".format(package)
                backtitle = "{0} {1}".format(self.meta.__all__,
                                             self.meta.__version__)
                status = True
                deps = DialogUtil(packages, text, " Remove ", backtitle,
                                  status).checklist()
                for d in deps:
                    dependencies.append("-".join(d.split("-")[:-1]))
                self.meta.remove_deps_answer = "y"
            else:
                print("")   # new line at start
                self.msg.template(78)
                print("| Found dependencies for the package {0}:".format(
                    package))
                self.msg.template(78)
                for pkg in packages:
                    find = find_package(pkg + self.meta.sp, self.meta.pkg_path)
                    self._sizes(find[0])
                    print("| {0}{1}{2}".format(self.meta.color["RED"], pkg,
                                               self.meta.color["ENDC"]))
                self.msg.template(78)
                self._calc_sizes()
                print("| {0}Size of removed dependencies {1} {2}{3}".format(
                    self.meta.color["GREY"], round(self.size, 2), self.unit,
                    self.meta.color["ENDC"]))
                self.msg.template(78)
        return dependencies
925650
def filter_installed_packages(packages):
    """"""
    yb = yum.YumBase()
    package_list = yb.doPackageLists()
    temp_cache = {p.base_package_name: 1 for p in package_list['installed']}

    _pkgs = [p for p in packages if not temp_cache.get(p, False)]
    return _pkgs
1340894
def getPackages(self, distribution = "rawhide"):
		
		if self._packages == {}:
			file_location = "%s/data/distribution_packages.json" % getScriptDir(__file__)
			with open(file_location, "r") as f:
				packages = json.load(f)
			for pkg in packages:
				for distro in pkg["distributions"]:
					try:
						self._packages[distro].append(pkg["package"])
					except KeyError:
						self._packages[distro] = [pkg["package"]]

		return self._packages[distribution]