Updated third-party option

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2019-01-15 19:07:23 +01:00
parent 797b50ef0d
commit 4d799655b7
2 changed files with 14 additions and 9 deletions

View file

@ -167,12 +167,13 @@ class PackageManager(object):
pkg = "" pkg = ""
extra = "" extra = ""
elif "--third-party" in extra: elif "--third-party" in extra:
slackware_packages = slackware_repository() slack_packages, slack_names = slackware_repository()
slpkg_pkg = self.meta.__all__ + "-" + self.meta.__version__ slpkg_pkg = self.meta.__all__ + "-" + self.meta.__version__
binary = self.binary binary = self.binary
for pkg in find_package("", self.meta.pkg_path): for pkg in find_package("", self.meta.pkg_path):
slack_name = split_package(pkg)[0]
for tag in binary: for tag in binary:
if (pkg not in slackware_packages and if (slack_name not in slack_names and
slpkg_pkg not in pkg and tag in pkg): slpkg_pkg not in pkg and tag in pkg):
removed.append(split_package(pkg)[0]) removed.append(split_package(pkg)[0])
packages.append(pkg) packages.append(pkg)
@ -406,7 +407,7 @@ class PackageManager(object):
""" """
matching, packages = 0, [] matching, packages = 0, []
pkg_cache, match_cache = "", "" pkg_cache, match_cache = "", ""
slackware_packages = slackware_repository() slack_packages, slack_names = slackware_repository()
print("\nPackages with matching name [ {0}{1}{2} ]\n".format( print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
self.meta.color["CYAN"], ", ".join(self.binary), self.meta.color["CYAN"], ", ".join(self.binary),
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
@ -414,14 +415,15 @@ class PackageManager(object):
for match in find_package("", self.meta.pkg_path): for match in find_package("", self.meta.pkg_path):
pkg_cache = pkg pkg_cache = pkg
match_cache = match match_cache = match
split_name = split_package(match)[0]
if "--case-ins" in flag: if "--case-ins" in flag:
pkg_cache = pkg.lower() pkg_cache = pkg.lower()
match_cache = match.lower() match_cache = match.lower()
if ("--third-party" in flag and not self.binary and if ("--third-party" in flag and not self.binary and
match not in slackware_packages): split_name not in slack_names):
packages.append(match) packages.append(match)
if ("--third-party" in flag and pkg_cache in match_cache and if ("--third-party" in flag and pkg_cache in match_cache and
match not in slackware_packages): split_name not in slack_names):
packages.append(match) packages.append(match)
if pkg_cache in match_cache and not flag: if pkg_cache in match_cache and not flag:
packages.append(match) packages.append(match)

View file

@ -24,16 +24,19 @@
from slpkg.utils import Utils from slpkg.utils import Utils
from slpkg.binary.greps import repo_data from slpkg.binary.greps import repo_data
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
def slackware_repository(): def slackware_repository():
"""Return all official Slackware packages without the extension .txz """Return all official Slackware packages
""" """
slack_repo, slackware_repo = [], [] slack_repo, packages, names, name = [], [], [], ""
slack_repo = repo_data( slack_repo = repo_data(
Utils().read_file(_meta_.lib_path + "slack_repo/PACKAGES.TXT"), Utils().read_file(_meta_.lib_path + "slack_repo/PACKAGES.TXT"),
"slack", "") "slack", "")
for pkg in slack_repo[0]: for pkg in slack_repo[0]:
slackware_repo.append(pkg[:-4]) name = split_package(pkg)[0]
return slackware_repo names.append(name)
packages.append(pkg[:-4])
return packages, names