mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Clean up dependencies
This commit is contained in:
parent
8e65e88602
commit
f0efbf3c02
1 changed files with 14 additions and 3 deletions
|
@ -7,10 +7,11 @@ from dialog import Dialog
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.views.version import Version
|
from slpkg.dependencies import Requires
|
||||||
from slpkg.queries import SBoQueries
|
from slpkg.queries import SBoQueries
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.blacklist import Blacklist
|
from slpkg.blacklist import Blacklist
|
||||||
|
from slpkg.views.version import Version
|
||||||
|
|
||||||
|
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
@ -29,6 +30,7 @@ class Upgrade:
|
||||||
""" Compares version of packages and returns the maximum. """
|
""" Compares version of packages and returns the maximum. """
|
||||||
repo_packages = SBoQueries('').sbos()
|
repo_packages = SBoQueries('').sbos()
|
||||||
black = Blacklist().get()
|
black = Blacklist().get()
|
||||||
|
upgrade, requires = [], []
|
||||||
|
|
||||||
for pkg in os.listdir(self.configs.log_packages):
|
for pkg in os.listdir(self.configs.log_packages):
|
||||||
inst_pkg_name = self.utils.split_installed_pkg(pkg)[0]
|
inst_pkg_name = self.utils.split_installed_pkg(pkg)[0]
|
||||||
|
@ -41,7 +43,16 @@ class Upgrade:
|
||||||
repo_ver = SBoQueries(inst_pkg_name).version()
|
repo_ver = SBoQueries(inst_pkg_name).version()
|
||||||
|
|
||||||
if LooseVersion(repo_ver) > LooseVersion(installed_ver):
|
if LooseVersion(repo_ver) > LooseVersion(installed_ver):
|
||||||
yield inst_pkg_name
|
upgrade.append(inst_pkg_name)
|
||||||
|
|
||||||
|
# Creating a list with requires
|
||||||
|
for pkg in upgrade:
|
||||||
|
requires += Requires(pkg).resolve()
|
||||||
|
|
||||||
|
# Clean the packages if they are dependencies
|
||||||
|
for pkg in upgrade:
|
||||||
|
if pkg not in requires:
|
||||||
|
yield pkg
|
||||||
|
|
||||||
def packages(self):
|
def packages(self):
|
||||||
""" Choose packages for upgrade. """
|
""" Choose packages for upgrade. """
|
||||||
|
@ -52,7 +63,7 @@ class Upgrade:
|
||||||
pkg = self.utils.is_installed(package)
|
pkg = self.utils.is_installed(package)
|
||||||
inst_ver = self.utils.split_installed_pkg(pkg)[1]
|
inst_ver = self.utils.split_installed_pkg(pkg)[1]
|
||||||
repo_ver = SBoQueries(package).version()
|
repo_ver = SBoQueries(package).version()
|
||||||
choices += [(package, f'{inst_ver} -> {repo_ver}', False)]
|
choices += [(package, f'{inst_ver} -> {repo_ver}', True)]
|
||||||
|
|
||||||
code, tags = self.d.checklist(f'There are {len(choices)} packages for upgrade:',
|
code, tags = self.d.checklist(f'There are {len(choices)} packages for upgrade:',
|
||||||
title='Choose packages you want to upgrade',
|
title='Choose packages you want to upgrade',
|
||||||
|
|
Loading…
Add table
Reference in a new issue