From 048a694c165ea2704bf93c0c0b88f1307b06ad53 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 6 Jan 2023 22:10:35 +0200 Subject: [PATCH 1/7] Improve speed --- ChangeLog.txt | 4 +++ slpkg/dependees.py | 65 +++++++++++++++++++--------------------------- 2 files changed, 31 insertions(+), 38 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 33e3feb3..213524c9 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.4.6 - 06/01/2023 +Updated: +- Improve speed for dependees + 4.4.5 - 03/01/2023 Added: - New modern view mode style diff --git a/slpkg/dependees.py b/slpkg/dependees.py index ca70e3d9..93b02add 100644 --- a/slpkg/dependees.py +++ b/slpkg/dependees.py @@ -1,11 +1,10 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -from progress.spinner import PixelSpinner - from slpkg.configs import Configs from slpkg.views.ascii import Ascii -from slpkg.queries import SBoQueries +from slpkg.models.models import SBoTable +from slpkg.models.models import session as Session class Dependees: @@ -15,19 +14,19 @@ class Dependees: self.packages = packages self.flags = flags self.configs = Configs + self.session = Session self.ascii = Ascii() self.llc = self.ascii.lower_left_corner self.hl = self.ascii.horizontal_line self.var = self.ascii.vertical_and_right self.colors = self.configs.colour - self.colors = self.configs.colour self.color = self.colors() self.bold = self.color['bold'] self.violet = self.color['violet'] self.cyan = self.color['cyan'] self.grey = self.color['grey'] self.yellow = self.color['yellow'] - self.bviolet = f'{self.bold}{self.violet}' + self.byellow = f'{self.bold}{self.yellow}' self.endc = self.color['endc'] def slackbuilds(self): @@ -35,40 +34,30 @@ class Dependees: print(f"The list below shows the " f"packages that dependees on '{', '.join([p for p in self.packages])}':\n") - dependees = {} - spinner = PixelSpinner(f'{self.endc}Collecting the data... {self.bviolet}') - for package in self.packages: - found = [] # Reset list every package - sbos = SBoQueries('').sbos() + for pkg in self.packages: + dependees = list(self.find_requires(pkg)) + print(f'{self.byellow}pkg{self.endc}') + print(f' {self.llc}{self.hl}', end='') + if not dependees: + print(f'{self.cyan}No dependees found{self.endc}') - for sbo in sbos: - requires = SBoQueries(sbo).requires() - spinner.next() + sp = ' ' * 3 + for i, dep in enumerate(dependees, start=1): + if i == 1: + print(f'{self.cyan}{dep[0]}{self.endc}') + else: + print(f'{sp}{self.cyan}{dep[0]}{self.endc}') - if package in requires: - found.append(sbo) - dependees[package] = found - - last = f' {self.llc}{self.hl}' - print('\n') - if dependees: - for key, value in dependees.items(): - print(f'{self.yellow}{key}{self.endc}') - print(end=f'\r{last}') - char = f' {self.var}{self.hl}' - - for i, v in enumerate(value, start=1): - if i == len(value): - char = last - - if i == 1: - print(f'{self.cyan}{v}{self.endc}') + if '--full-reverse' in self.flags: + if i == len(dependees): + print(" " * 4 + f' {self.llc}{self.hl}{self.violet}{dep[1]}{self.endc}') else: - print(f'{" " * 3}{self.cyan}{v}{self.endc}') + print(" " * 4 + f' {self.var}{self.hl}{self.violet}{dep[1]}{self.endc}') + print(f'\n{self.grey}{len(dependees)} dependees for {pkg}{self.endc}\n') - if '--full-reverse' in self.flags: - print(f'{" " * 4}{char} {" ".join([req for req in SBoQueries(v).requires()])}') - - print(f'\n{self.grey}{len(value)} dependees for {key}{self.endc}\n') - else: - print(f'{self.endc}No dependees found.\n') + def find_requires(self, sbo): + """ Find requires that slackbuild dependees. """ + requires = self.session.query(SBoTable.name, SBoTable.requires).all() + for req in requires: + if [r for r in req[1].split() if r == sbo]: + yield req From 97bfc1fd2f58871bc8ea4482084cb33124da4e75 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 6 Jan 2023 22:12:15 +0200 Subject: [PATCH 2/7] Fixed for {} --- slpkg/dependees.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/dependees.py b/slpkg/dependees.py index 93b02add..1c166fd6 100644 --- a/slpkg/dependees.py +++ b/slpkg/dependees.py @@ -36,7 +36,7 @@ class Dependees: for pkg in self.packages: dependees = list(self.find_requires(pkg)) - print(f'{self.byellow}pkg{self.endc}') + print(f'{self.byellow}{pkg}{self.endc}') print(f' {self.llc}{self.hl}', end='') if not dependees: print(f'{self.cyan}No dependees found{self.endc}') From b55cc76c18eb97efc94fec9958ff41b814851236 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 6 Jan 2023 22:18:12 +0200 Subject: [PATCH 3/7] Fixed spaces --- slpkg/dependees.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/slpkg/dependees.py b/slpkg/dependees.py index 1c166fd6..0a7d3b6f 100644 --- a/slpkg/dependees.py +++ b/slpkg/dependees.py @@ -39,20 +39,20 @@ class Dependees: print(f'{self.byellow}{pkg}{self.endc}') print(f' {self.llc}{self.hl}', end='') if not dependees: - print(f'{self.cyan}No dependees found{self.endc}') + print(f'{self.cyan}No dependees{self.endc}') - sp = ' ' * 3 + sp = ' ' * 4 for i, dep in enumerate(dependees, start=1): if i == 1: - print(f'{self.cyan}{dep[0]}{self.endc}') + print(f' {self.cyan}{dep[0]}{self.endc}') else: print(f'{sp}{self.cyan}{dep[0]}{self.endc}') if '--full-reverse' in self.flags: if i == len(dependees): - print(" " * 4 + f' {self.llc}{self.hl}{self.violet}{dep[1]}{self.endc}') + print(" " * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}') else: - print(" " * 4 + f' {self.var}{self.hl}{self.violet}{dep[1]}{self.endc}') + print(" " * 4 + f' {self.var}{self.hl} {self.violet}{dep[1]}{self.endc}') print(f'\n{self.grey}{len(dependees)} dependees for {pkg}{self.endc}\n') def find_requires(self, sbo): From b97744512453a6431950add23eca06064a59842c Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 6 Jan 2023 22:30:01 +0200 Subject: [PATCH 4/7] Fixed summary for build --- ChangeLog.txt | 2 ++ slpkg/views/views.py | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 213524c9..19997adf 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,8 @@ 4.4.6 - 06/01/2023 Updated: - Improve speed for dependees +Fixed: +- summary for build 4.4.5 - 03/01/2023 Added: diff --git a/slpkg/views/views.py b/slpkg/views/views.py index f61bf2d3..dc10da5e 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -231,8 +231,6 @@ class ViewMessage: upgrade += 1 elif installed and option == 'remove': remove += 1 - else: - build += 1 self.draw_bottom_line() @@ -241,7 +239,7 @@ class ViewMessage: f'installed and {upgrade} will be upgraded.{self.endc}') elif option == 'build': - print(f'{self.grey}Total {build} packages ' + print(f'{self.grey}Total {len(slackbuilds)} packages ' f'will be build in {self.configs.tmp_path} folder.{self.endc}') elif option == 'remove': From 7d406aeebb87ee028fa6e2b91036afb6bf563929 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 6 Jan 2023 22:47:23 +0200 Subject: [PATCH 5/7] Make bold --- slpkg/downloader.py | 4 +++- slpkg/remove_packages.py | 4 +++- slpkg/slackbuild.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/slpkg/downloader.py b/slpkg/downloader.py index 6cf1e614..b6778ffc 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -20,8 +20,10 @@ class Downloader: self.configs = Configs self.colors = self.configs.colour self.color = self.colors() + self.bold = self.color['bold'] self.green = self.color['green'] self.yellow = self.color['yellow'] + self.byellow = f'{self.bold}{self.yellow}' self.endc = self.color['endc'] self.progress = ProgressBar() self.stderr = None @@ -52,7 +54,7 @@ class Downloader: # Terminate process 2 if process 1 finished if not p1.is_alive(): - print(f'{self.endc}{self.yellow} Done{self.endc}', end='') + print(f'{self.endc}{self.byellow} Done{self.endc}', end='') p2.terminate() # Wait until process 2 finish diff --git a/slpkg/remove_packages.py b/slpkg/remove_packages.py index c9b669b9..5f921916 100644 --- a/slpkg/remove_packages.py +++ b/slpkg/remove_packages.py @@ -23,7 +23,9 @@ class RemovePackages: self.configs = Configs self.colors = self.configs.colour self.color = self.colors() + self.bold = self.color['bold'] self.yellow = self.color['yellow'] + self.byellow = f'{self.bold}{self.yellow}' self.red = self.color['red'] self.endc = self.color['endc'] self.installed_packages = [] @@ -93,7 +95,7 @@ class RemovePackages: # Terminate process 2 if process 1 finished if not p1.is_alive(): - print(f'{self.endc}{self.yellow} Done{self.endc}', end='') + print(f'{self.endc}{self.byellow} Done{self.endc}', end='') p2.terminate() # Wait until process 2 finish diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index e1c7637e..d92180ac 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -37,9 +37,11 @@ class Slackbuilds: self.configs = Configs self.colors = self.configs.colour self.color = self.colors() + self.bold = self.color['bold'] self.cyan = self.color['cyan'] self.red = self.color['red'] self.yellow = self.color['yellow'] + self.byellow = f'{self.bold}{self.yellow}' self.endc = self.color['endc'] self.install_order = [] self.dependencies = [] @@ -299,7 +301,7 @@ class Slackbuilds: # Terminate process 2 if process 1 finished if not p1.is_alive(): - print(f'{self.endc}{self.yellow} Done{self.endc}', end='') + print(f'{self.endc}{self.byellow} Done{self.endc}', end='') p2.terminate() # Wait until process 2 finish From 084b5eb9a55ea710f0808b5e1d8f87fad7f2a810 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 6 Jan 2023 23:02:10 +0200 Subject: [PATCH 6/7] Remove python-toml --- ChangeLog.txt | 2 ++ README.rst | 1 - requirements.txt | 3 +-- setup.cfg | 1 - slpkg/views/view_package.py | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 19997adf..00195883 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,8 @@ Updated: - Improve speed for dependees Fixed: - summary for build +Remove: +- python-toml dependency 4.4.5 - 03/01/2023 Added: diff --git a/README.rst b/README.rst index fa33a62c..73c6b8a7 100644 --- a/README.rst +++ b/README.rst @@ -23,7 +23,6 @@ Requirements SQLAlchemy >= 1.4.36 pythondialog >= 3.5.3 progress >= 1.6 - toml >= 0.10.2 Install ------- diff --git a/requirements.txt b/requirements.txt index 6ee3d74d..7d355254 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ SQLAlchemy >= 1.4.46 pythondialog >= 3.5.3 -progress >= 1.6 -toml >= 0.10.2 \ No newline at end of file +progress >= 1.6 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index aaac060a..8200d48f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,6 @@ install_requires = SQLAlchemy >= 1.4.36 pythondialog >= 3.5.3 progress >= 1.6 - toml >= 0.10.2 include_package_data = True [options.packages.find] diff --git a/slpkg/views/view_package.py b/slpkg/views/view_package.py index a33910fb..2ce2cce0 100644 --- a/slpkg/views/view_package.py +++ b/slpkg/views/view_package.py @@ -4,8 +4,8 @@ import urllib3 from slpkg.configs import Configs -from slpkg.models.models import SBoTable from slpkg.queries import SBoQueries +from slpkg.models.models import SBoTable from slpkg.models.models import session as Session From 5b944837340e51ecec0f1551eef8eb655751ff43 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 6 Jan 2023 23:03:50 +0200 Subject: [PATCH 7/7] Updated for version 4.4.6 --- README.rst | 4 ++-- setup.cfg | 2 +- slpkg/views/version.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 73c6b8a7..3fdf3fee 100644 --- a/README.rst +++ b/README.rst @@ -31,8 +31,8 @@ Install from the official third-party `SBo repository