Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2023-01-06 23:06:54 +02:00
commit 83f44ffdb9
11 changed files with 51 additions and 53 deletions

View file

@ -1,3 +1,11 @@
4.4.6 - 06/01/2023
Updated:
- Improve speed for dependees
Fixed:
- summary for build
Remove:
- python-toml dependency
4.4.5 - 03/01/2023 4.4.5 - 03/01/2023
Added: Added:
- New modern view mode style - New modern view mode style

View file

@ -23,7 +23,6 @@ Requirements
SQLAlchemy >= 1.4.36 SQLAlchemy >= 1.4.36
pythondialog >= 3.5.3 pythondialog >= 3.5.3
progress >= 1.6 progress >= 1.6
toml >= 0.10.2
Install Install
------- -------
@ -32,8 +31,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
.. code-block:: bash .. code-block:: bash
$ tar xvf slpkg-4.4.5.tar.gz $ tar xvf slpkg-4.4.6.tar.gz
$ cd slpkg-4.4.5 $ cd slpkg-4.4.6
$ ./install.sh $ ./install.sh
Screenshots Screenshots

View file

@ -1,4 +1,3 @@
SQLAlchemy >= 1.4.46 SQLAlchemy >= 1.4.46
pythondialog >= 3.5.3 pythondialog >= 3.5.3
progress >= 1.6 progress >= 1.6
toml >= 0.10.2

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = slpkg name = slpkg
version = 4.4.5 version = 4.4.6
license_file = LICENSE license_file = LICENSE
author = Dimitris Zlatanidis author = Dimitris Zlatanidis
author_email = d.zlatanidis@gmail.com author_email = d.zlatanidis@gmail.com
@ -41,7 +41,6 @@ install_requires =
SQLAlchemy >= 1.4.36 SQLAlchemy >= 1.4.36
pythondialog >= 3.5.3 pythondialog >= 3.5.3
progress >= 1.6 progress >= 1.6
toml >= 0.10.2
include_package_data = True include_package_data = True
[options.packages.find] [options.packages.find]

View file

@ -1,11 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from progress.spinner import PixelSpinner
from slpkg.configs import Configs from slpkg.configs import Configs
from slpkg.views.ascii import Ascii 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: class Dependees:
@ -15,19 +14,19 @@ class Dependees:
self.packages = packages self.packages = packages
self.flags = flags self.flags = flags
self.configs = Configs self.configs = Configs
self.session = Session
self.ascii = Ascii() self.ascii = Ascii()
self.llc = self.ascii.lower_left_corner self.llc = self.ascii.lower_left_corner
self.hl = self.ascii.horizontal_line self.hl = self.ascii.horizontal_line
self.var = self.ascii.vertical_and_right self.var = self.ascii.vertical_and_right
self.colors = self.configs.colour self.colors = self.configs.colour
self.colors = self.configs.colour
self.color = self.colors() self.color = self.colors()
self.bold = self.color['bold'] self.bold = self.color['bold']
self.violet = self.color['violet'] self.violet = self.color['violet']
self.cyan = self.color['cyan'] self.cyan = self.color['cyan']
self.grey = self.color['grey'] self.grey = self.color['grey']
self.yellow = self.color['yellow'] self.yellow = self.color['yellow']
self.bviolet = f'{self.bold}{self.violet}' self.byellow = f'{self.bold}{self.yellow}'
self.endc = self.color['endc'] self.endc = self.color['endc']
def slackbuilds(self): def slackbuilds(self):
@ -35,40 +34,30 @@ class Dependees:
print(f"The list below shows the " print(f"The list below shows the "
f"packages that dependees on '{', '.join([p for p in self.packages])}':\n") f"packages that dependees on '{', '.join([p for p in self.packages])}':\n")
dependees = {} for pkg in self.packages:
spinner = PixelSpinner(f'{self.endc}Collecting the data... {self.bviolet}') dependees = list(self.find_requires(pkg))
for package in self.packages: print(f'{self.byellow}{pkg}{self.endc}')
found = [] # Reset list every package print(f' {self.llc}{self.hl}', end='')
sbos = SBoQueries('').sbos() if not dependees:
print(f'{self.cyan}No dependees{self.endc}')
for sbo in sbos: sp = ' ' * 4
requires = SBoQueries(sbo).requires() for i, dep in enumerate(dependees, start=1):
spinner.next() 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: if '--full-reverse' in self.flags:
found.append(sbo) if i == len(dependees):
dependees[package] = found print(" " * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}')
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}')
else: 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: def find_requires(self, sbo):
print(f'{" " * 4}{char} {" ".join([req for req in SBoQueries(v).requires()])}') """ Find requires that slackbuild dependees. """
requires = self.session.query(SBoTable.name, SBoTable.requires).all()
print(f'\n{self.grey}{len(value)} dependees for {key}{self.endc}\n') for req in requires:
else: if [r for r in req[1].split() if r == sbo]:
print(f'{self.endc}No dependees found.\n') yield req

View file

@ -20,8 +20,10 @@ class Downloader:
self.configs = Configs self.configs = Configs
self.colors = self.configs.colour self.colors = self.configs.colour
self.color = self.colors() self.color = self.colors()
self.bold = self.color['bold']
self.green = self.color['green'] self.green = self.color['green']
self.yellow = self.color['yellow'] self.yellow = self.color['yellow']
self.byellow = f'{self.bold}{self.yellow}'
self.endc = self.color['endc'] self.endc = self.color['endc']
self.progress = ProgressBar() self.progress = ProgressBar()
self.stderr = None self.stderr = None
@ -52,7 +54,7 @@ class Downloader:
# Terminate process 2 if process 1 finished # Terminate process 2 if process 1 finished
if not p1.is_alive(): 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() p2.terminate()
# Wait until process 2 finish # Wait until process 2 finish

View file

@ -23,7 +23,9 @@ class RemovePackages:
self.configs = Configs self.configs = Configs
self.colors = self.configs.colour self.colors = self.configs.colour
self.color = self.colors() self.color = self.colors()
self.bold = self.color['bold']
self.yellow = self.color['yellow'] self.yellow = self.color['yellow']
self.byellow = f'{self.bold}{self.yellow}'
self.red = self.color['red'] self.red = self.color['red']
self.endc = self.color['endc'] self.endc = self.color['endc']
self.installed_packages = [] self.installed_packages = []
@ -93,7 +95,7 @@ class RemovePackages:
# Terminate process 2 if process 1 finished # Terminate process 2 if process 1 finished
if not p1.is_alive(): 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() p2.terminate()
# Wait until process 2 finish # Wait until process 2 finish

View file

@ -37,9 +37,11 @@ class Slackbuilds:
self.configs = Configs self.configs = Configs
self.colors = self.configs.colour self.colors = self.configs.colour
self.color = self.colors() self.color = self.colors()
self.bold = self.color['bold']
self.cyan = self.color['cyan'] self.cyan = self.color['cyan']
self.red = self.color['red'] self.red = self.color['red']
self.yellow = self.color['yellow'] self.yellow = self.color['yellow']
self.byellow = f'{self.bold}{self.yellow}'
self.endc = self.color['endc'] self.endc = self.color['endc']
self.install_order = [] self.install_order = []
self.dependencies = [] self.dependencies = []
@ -299,7 +301,7 @@ class Slackbuilds:
# Terminate process 2 if process 1 finished # Terminate process 2 if process 1 finished
if not p1.is_alive(): 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() p2.terminate()
# Wait until process 2 finish # Wait until process 2 finish

View file

@ -5,7 +5,7 @@ class Version:
""" Print the version. """ """ Print the version. """
def __init__(self): def __init__(self):
self.version_info = (4, 4, 5) self.version_info = (4, 4, 6)
self.version = '{0}.{1}.{2}'.format(*self.version_info) self.version = '{0}.{1}.{2}'.format(*self.version_info)
self.license = 'MIT License' self.license = 'MIT License'
self.author = 'Dimitris Zlatanidis (dslackw)' self.author = 'Dimitris Zlatanidis (dslackw)'

View file

@ -4,8 +4,8 @@
import urllib3 import urllib3
from slpkg.configs import Configs from slpkg.configs import Configs
from slpkg.models.models import SBoTable
from slpkg.queries import SBoQueries from slpkg.queries import SBoQueries
from slpkg.models.models import SBoTable
from slpkg.models.models import session as Session from slpkg.models.models import session as Session

View file

@ -231,8 +231,6 @@ class ViewMessage:
upgrade += 1 upgrade += 1
elif installed and option == 'remove': elif installed and option == 'remove':
remove += 1 remove += 1
else:
build += 1
self.draw_bottom_line() self.draw_bottom_line()
@ -241,7 +239,7 @@ class ViewMessage:
f'installed and {upgrade} will be upgraded.{self.endc}') f'installed and {upgrade} will be upgraded.{self.endc}')
elif option == 'build': 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}') f'will be build in {self.configs.tmp_path} folder.{self.endc}')
elif option == 'remove': elif option == 'remove':