Updated for new added packages

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-09-20 19:59:07 +03:00
parent e0d39dd964
commit ceddfdb536
3 changed files with 15 additions and 2 deletions

View file

@ -5,6 +5,9 @@
- Fixed: - Fixed:
* Fixed ascii characters done and failed * Fixed ascii characters done and failed
- Updated:
* Updated the upgrade method to first add newly added packages to install
### 5.1.2 - 22/08/2024 ### 5.1.2 - 22/08/2024
- Fixed: - Fixed:

View file

@ -448,6 +448,7 @@ class Menu(Configs): # pylint: disable=[R0902]
""" """
command: str = Menu.upgrade.__name__ command: str = Menu.upgrade.__name__
removed: list = [] removed: list = []
added: list = []
if len(self.args) == 1: if len(self.args) == 1:
@ -464,14 +465,23 @@ class Menu(Configs): # pylint: disable=[R0902]
for package in packages: for package in packages:
if package.endswith('_Removed.'): if package.endswith('_Removed.'):
removed.append(package.replace('_Removed.', '')) removed.append(package.replace('_Removed.', ''))
if package.endswith('_Added.'):
added.append(package.replace('_Added.', ''))
if removed: if removed:
packages = [pkg for pkg in packages if not pkg.endswith('_Removed.')] packages = [pkg for pkg in packages if not pkg.endswith('_Removed.')]
remove = RemovePackages(removed, self.flags) remove = RemovePackages(removed, self.flags)
remove.remove(upgrade=True) remove.remove(upgrade=True)
if added:
packages = [pkg for pkg in packages if not pkg.endswith('_Added.')]
added = self.choose.packages(self.data, added, command)
packages: list = self.choose.packages(self.data, packages, command) packages: list = self.choose.packages(self.data, packages, command)
# Add the new added packages front to list for install.
packages: list = added.extend(packages)
if not packages: if not packages:
print('\nEverything is up-to-date!\n') print('\nEverything is up-to-date!\n')
raise SystemExit(0) raise SystemExit(0)

View file

@ -84,12 +84,12 @@ class Upgrade(Configs): # pylint: disable=[R0902]
if self.repository in self.repos.remove_packages: if self.repository in self.repos.remove_packages:
if name not in self.data.keys(): if name not in self.data.keys():
yield name + '_Removed.' yield f'{name}_Removed.'
if self.repository in self.repos.new_packages: if self.repository in self.repos.new_packages:
for name in self.data.keys(): for name in self.data.keys():
if not self.utils.is_package_installed(name): if not self.utils.is_package_installed(name):
yield name yield f'{name}_Added.'
def is_package_upgradeable(self, installed: str) -> bool: # pylint: disable=[R0911] def is_package_upgradeable(self, installed: str) -> bool: # pylint: disable=[R0911]
"""Return True for upgradeable packages. """Return True for upgradeable packages.