mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
Removed for configs
This commit is contained in:
parent
27eec482fd
commit
32348f7510
8 changed files with 98 additions and 80 deletions
|
@ -6,6 +6,7 @@ from slpkg.configs import Configs
|
|||
from slpkg.views.ascii import Ascii
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import SBoTable, PonceTable
|
||||
|
||||
|
@ -21,6 +22,7 @@ class Dependees(Configs, Utilities):
|
|||
|
||||
self.session = Session
|
||||
self.ascii = Ascii()
|
||||
self.repos = Repositories()
|
||||
self.color = self.colour()
|
||||
|
||||
self.llc: str = self.ascii.lower_left_corner
|
||||
|
@ -38,7 +40,7 @@ class Dependees(Configs, Utilities):
|
|||
|
||||
# Switch between sbo and ponce repository.
|
||||
self.sbo_table = SBoTable
|
||||
if self.ponce_repo:
|
||||
if self.repos.ponce_repo:
|
||||
self.sbo_table = PonceTable
|
||||
|
||||
def slackbuilds(self) -> None:
|
||||
|
|
|
@ -10,6 +10,7 @@ from slpkg.queries import SBoQueries
|
|||
from slpkg.utilities import Utilities
|
||||
from slpkg.downloader import Downloader
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
|
@ -21,6 +22,7 @@ class Download(Configs, Utilities):
|
|||
super(Utilities, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.directory: str = directory
|
||||
self.repos = Repositories()
|
||||
|
||||
self.session = Session
|
||||
|
||||
|
@ -40,12 +42,12 @@ class Download(Configs, Utilities):
|
|||
for sbo in slackbuilds:
|
||||
location: str = SBoQueries(sbo).location()
|
||||
|
||||
if self.ponce_repo:
|
||||
ponce_repo_path_package = Path(self.ponce_repo_path, location, sbo)
|
||||
if self.repos.ponce_repo:
|
||||
ponce_repo_path_package = Path(self.repos.ponce_repo_path, location, sbo)
|
||||
shutil.copytree(ponce_repo_path_package, f'{download_path}{sbo}')
|
||||
else:
|
||||
file: str = f'{sbo}{self.sbo_tar_suffix}'
|
||||
url: list = [f'{self.sbo_repo_url}{location}/{file}']
|
||||
file: str = f'{sbo}{self.repos.sbo_repo_tar_suffix}'
|
||||
url: list = [f'{self.repos.sbo_repo_url}{location}/{file}']
|
||||
down_sbo = Downloader(download_path, url, self.flags)
|
||||
down_sbo.download()
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class FormConfigs(Configs):
|
|||
""" Read and write the configuration file. """
|
||||
self.is_dialog_enabled()
|
||||
elements: list = []
|
||||
height: int = 35
|
||||
height: int = 30
|
||||
width: int = 74
|
||||
text: str = f'Edit the configuration file: {self.config_file}'
|
||||
title: str = ' Configuration File '
|
||||
|
@ -69,8 +69,14 @@ class FormConfigs(Configs):
|
|||
|
||||
def check_configs(self, tags: list) -> bool:
|
||||
""" Check for true of false values. """
|
||||
keys: list = ['COLORS', 'DIALOG', 'SILENT_MODE', 'ASCII_CHARACTERS',
|
||||
'PONCE_REPO', 'ASK_QUESTION', 'PARALLEL_DOWNLOADS']
|
||||
keys: list = [
|
||||
'COLORS',
|
||||
'DIALOG',
|
||||
'SILENT_MODE',
|
||||
'ASCII_CHARACTERS',
|
||||
'ASK_QUESTION',
|
||||
'PARALLEL_DOWNLOADS'
|
||||
]
|
||||
values: list = ['true', 'false']
|
||||
|
||||
for key, value in zip(self.configs['CONFIGS'].keys(), tags):
|
||||
|
@ -102,9 +108,14 @@ class FormConfigs(Configs):
|
|||
if line.lstrip().startswith(f'{key} ='):
|
||||
line = f' {key} = "{value}"\n'
|
||||
|
||||
if line.lstrip().startswith(('COLORS =', 'DIALOG =', 'SILENT_MODE =',
|
||||
'ASCII_CHARACTERS =', 'PONCE_REPO =',
|
||||
'ASK_QUESTION =', 'PARALLEL_DOWNLOADS =')):
|
||||
if line.lstrip().startswith(
|
||||
|
||||
('COLORS =', 'DIALOG =',
|
||||
'SILENT_MODE =',
|
||||
'ASCII_CHARACTERS =',
|
||||
'ASK_QUESTION =',
|
||||
'PARALLEL_DOWNLOADS =')
|
||||
):
|
||||
line = line.replace('"', '')
|
||||
|
||||
patch_toml.write(line)
|
||||
|
|
|
@ -20,8 +20,7 @@ class CreateData(Configs):
|
|||
self.session = Session
|
||||
self.utils = Utilities()
|
||||
self.query = SBoQueries('')
|
||||
self.repositories = Repositories()
|
||||
self.repos: dict = self.repositories.configs()
|
||||
self.repos = Repositories()
|
||||
|
||||
def install_sbo_table(self) -> None:
|
||||
""" Install the data for SBo repository. """
|
||||
|
@ -38,11 +37,11 @@ class CreateData(Configs):
|
|||
'SLACKBUILD SHORT DESCRIPTION:'
|
||||
]
|
||||
sbo_table = SBoTable
|
||||
path = Path(self.sbo_repo_path, self.repos['SBO_REPO_TXT'])
|
||||
path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_txt)
|
||||
|
||||
if self.repos['PONCE_REPO']:
|
||||
if self.repos.ponce_repo:
|
||||
sbo_table = PonceTable
|
||||
path = Path(self.ponce_repo_path, self.repos['PONCE_REPO_TXT'])
|
||||
path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_txt)
|
||||
|
||||
sbo_file: list = self.utils.read_file(path)
|
||||
|
||||
|
@ -82,7 +81,7 @@ class CreateData(Configs):
|
|||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE DESCRIPTION:',
|
||||
]
|
||||
path = Path(self.lib_path, 'repositories', repo, self.repos['GNOME_REPO_PKG_TXT'])
|
||||
path = Path(self.lib_path, 'repositories', repo, self.repos.gnome_repo_pkg_txt)
|
||||
|
||||
pkg_txt: list = self.utils.read_file(path)
|
||||
|
||||
|
|
|
@ -25,17 +25,17 @@ class SBoTable(Base):
|
|||
|
||||
__tablename__ = 'sbotable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True) # type: ignore
|
||||
name: str = Column(Text) # type: ignore
|
||||
location: str = Column(Text) # type: ignore
|
||||
files: str = Column(Text) # type: ignore
|
||||
version: str = Column(Text) # type: ignore
|
||||
download: str = Column(Text) # type: ignore
|
||||
download64: str = Column(Text) # type: ignore
|
||||
md5sum: str = Column(Text) # type: ignore
|
||||
md5sum64: str = Column(Text) # type: ignore
|
||||
requires: str = Column(Text) # type: ignore
|
||||
short_description: str = Column(Text) # type: ignore
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
files: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
download: str = Column(Text)
|
||||
download64: str = Column(Text)
|
||||
md5sum: str = Column(Text)
|
||||
md5sum64: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
short_description: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -44,17 +44,17 @@ class PonceTable(Base):
|
|||
|
||||
__tablename__ = 'poncetable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True) # type: ignore
|
||||
name: str = Column(Text) # type: ignore
|
||||
location: str = Column(Text) # type: ignore
|
||||
files: str = Column(Text) # type: ignore
|
||||
version: str = Column(Text) # type: ignore
|
||||
download: str = Column(Text) # type: ignore
|
||||
download64: str = Column(Text) # type: ignore
|
||||
md5sum: str = Column(Text) # type: ignore
|
||||
md5sum64: str = Column(Text) # type: ignore
|
||||
requires: str = Column(Text) # type: ignore
|
||||
short_description: str = Column(Text) # type: ignore
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
files: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
download: str = Column(Text)
|
||||
download64: str = Column(Text)
|
||||
md5sum: str = Column(Text)
|
||||
md5sum64: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
short_description: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -63,19 +63,19 @@ class BinariesTable(Base):
|
|||
|
||||
__tablename__ = 'binariestable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True) # type: ignore
|
||||
repo: str = Column(Text) # type: ignore
|
||||
name: str = Column(Text) # type: ignore
|
||||
version: str = Column(Text) # type: ignore
|
||||
package: str = Column(Text) # type: ignore
|
||||
mirror: str = Column(Text) # type: ignore
|
||||
location: str = Column(Text) # type: ignore
|
||||
size_comp: str = Column(Text) # type: ignore
|
||||
size_uncomp: str = Column(Text) # type: ignore
|
||||
requires: str = Column(Text) # type: ignore
|
||||
conflicts: str = Column(Text) # type: ignore
|
||||
suggests: str = Column(Text) # type: ignore
|
||||
description: str = Column(Text) # type: ignore
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
repo: str = Column(Text)
|
||||
name: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
package: str = Column(Text)
|
||||
mirror: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
size_comp: str = Column(Text)
|
||||
size_uncomp: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
conflicts: str = Column(Text)
|
||||
suggests: str = Column(Text)
|
||||
description: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -84,9 +84,9 @@ class LogsDependencies(Base):
|
|||
|
||||
__tablename__ = 'logsdependencies'
|
||||
|
||||
id: int = Column(Integer, primary_key=True) # type: ignore
|
||||
name: str = Column(Text) # type: ignore
|
||||
requires: str = Column(Text) # type: ignore
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
|
||||
|
||||
Base.metadata.create_all(engine)
|
||||
|
|
|
@ -20,6 +20,7 @@ from slpkg.dependencies import Requires
|
|||
from slpkg.downloader import Downloader
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import LogsDependencies
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
@ -35,6 +36,7 @@ class Slackbuilds(Configs):
|
|||
self.mode: str = mode
|
||||
|
||||
self.session = Session
|
||||
self.repos = Repositories()
|
||||
self.utils = Utilities()
|
||||
self.progress = ProgressBar()
|
||||
self.dialogbox = DialogBox()
|
||||
|
@ -92,9 +94,9 @@ class Slackbuilds(Configs):
|
|||
# Checks if dependency exists in the ponce repository.
|
||||
# Sometimes the dependency reference is in the .info file,
|
||||
# but there is not exist in the repository as a folder.
|
||||
if self.ponce_repo:
|
||||
if self.repos.ponce_repo:
|
||||
location: str = SBoQueries(dep).location()
|
||||
path_ponce_repo_package = Path(self.ponce_repo_path, location, dep)
|
||||
path_ponce_repo_package = Path(self.repos.ponce_repo_path, location, dep)
|
||||
if not path_ponce_repo_package.is_dir():
|
||||
continue
|
||||
|
||||
|
@ -153,11 +155,11 @@ class Slackbuilds(Configs):
|
|||
slackbuild = Path(self.build_path, sbo, f'{sbo}.SlackBuild')
|
||||
|
||||
# Copy slackbuilds to the build folder.
|
||||
if self.ponce_repo:
|
||||
path_ponce_repo_package = Path(self.ponce_repo_path, location, sbo)
|
||||
if self.repos.ponce_repo:
|
||||
path_ponce_repo_package = Path(self.repos.ponce_repo_path, location, sbo)
|
||||
shutil.copytree(path_ponce_repo_package, f'{self.build_path}{sbo}')
|
||||
else:
|
||||
path_sbo_repo_package = Path(self.sbo_repo_path, location, sbo)
|
||||
path_sbo_repo_package = Path(self.repos.sbo_repo_path, location, sbo)
|
||||
shutil.copytree(path_sbo_repo_package, f'{self.build_path}{sbo}')
|
||||
|
||||
os.chmod(slackbuild, 0o775)
|
||||
|
@ -222,7 +224,7 @@ class Slackbuilds(Configs):
|
|||
with open(sbo_script, 'w') as script:
|
||||
for line in lines:
|
||||
if line.startswith('TAG=$'):
|
||||
line: str = f'TAG=${{TAG:-{self.repo_tag}}}\n'
|
||||
line: str = f'TAG=${{TAG:-{self.repos.repo_tag}}}\n'
|
||||
script.write(line)
|
||||
|
||||
def logging_installed_dependencies(self, name: str) -> None:
|
||||
|
@ -269,7 +271,7 @@ class Slackbuilds(Configs):
|
|||
installation. """
|
||||
version: str = SBoQueries(name).version()
|
||||
|
||||
pattern: str = f'{name}-{version}*{self.repo_tag}*'
|
||||
pattern: str = f'{name}-{version}*{self.repos.repo_tag}*'
|
||||
|
||||
tmp = Path(self.tmp_path)
|
||||
packages: list = [file.name for file in tmp.glob(pattern)]
|
||||
|
|
|
@ -133,7 +133,7 @@ class Utilities:
|
|||
def read_build_tag(self, sbo: str) -> str:
|
||||
""" Patching SBo TAG from the configuration file. """
|
||||
location: str = SBoQueries(sbo).location()
|
||||
sbo_script = Path(self.configs.sbo_repo_path, location, sbo, f'{sbo}.SlackBuild')
|
||||
sbo_script = Path(self.repos.sbo_repo_path, location, sbo, f'{sbo}.SlackBuild')
|
||||
|
||||
if sbo_script.is_file():
|
||||
with open(sbo_script, 'r', encoding='utf-8') as f:
|
||||
|
|
|
@ -6,6 +6,7 @@ from pathlib import Path
|
|||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import SBoTable, PonceTable
|
||||
|
||||
|
@ -18,18 +19,19 @@ class ViewPackage(Configs):
|
|||
self.flags: list = flags
|
||||
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
self.session = Session
|
||||
self.flag_pkg_version: list = ['-p', '--pkg-version']
|
||||
|
||||
# Switch between sbo and ponce repository.
|
||||
self.sbo_table = SBoTable
|
||||
self.repo_url: str = self.sbo_repo_url
|
||||
self.repo_path: str = self.sbo_repo_path
|
||||
self.repo_tar_suffix: str = self.sbo_tar_suffix
|
||||
if self.ponce_repo:
|
||||
self.repo_url: str = self.repos.sbo_repo_url
|
||||
self.repo_path: Path = self.repos.sbo_repo_path
|
||||
self.repo_tar_suffix: str = self.repos.sbo_repo_tar_suffix
|
||||
if self.repos.ponce_repo:
|
||||
self.sbo_table = PonceTable
|
||||
self.repo_url: str = self.ponce_repo_url
|
||||
self.repo_path: str = self.ponce_repo_path
|
||||
self.repo_url: str = self.repos.ponce_repo_url
|
||||
self.repo_path: Path = self.repos.ponce_repo_path
|
||||
self.repo_tar_suffix: str = ''
|
||||
|
||||
def package(self, packages: list) -> None:
|
||||
|
@ -45,16 +47,16 @@ class ViewPackage(Configs):
|
|||
for package in packages:
|
||||
|
||||
info: list = self.session.query(
|
||||
self.sbo_table.name, # type: ignore
|
||||
self.sbo_table.version, # type: ignore
|
||||
self.sbo_table.requires, # type: ignore
|
||||
self.sbo_table.download, # type: ignore
|
||||
self.sbo_table.download64, # type: ignore
|
||||
self.sbo_table.md5sum, # type: ignore
|
||||
self.sbo_table.md5sum64, # type: ignore
|
||||
self.sbo_table.files, # type: ignore
|
||||
self.sbo_table.short_description, # type: ignore
|
||||
self.sbo_table.location # type: ignore
|
||||
self.sbo_table.name,
|
||||
self.sbo_table.version,
|
||||
self.sbo_table.requires,
|
||||
self.sbo_table.download,
|
||||
self.sbo_table.download64,
|
||||
self.sbo_table.md5sum,
|
||||
self.sbo_table.md5sum64,
|
||||
self.sbo_table.files,
|
||||
self.sbo_table.short_description,
|
||||
self.sbo_table.location
|
||||
).filter(self.sbo_table.name == package).first()
|
||||
|
||||
path = Path(self.repo_path, info[9], info[0], 'README')
|
||||
|
@ -66,7 +68,7 @@ class ViewPackage(Configs):
|
|||
repo_build_tag = self.utils.read_build_tag(info[0])
|
||||
|
||||
maintainer, email, homepage = '', '', ''
|
||||
for line in info_file: # type: ignore
|
||||
for line in info_file:
|
||||
if line.startswith('HOMEPAGE'):
|
||||
homepage: str = line[10:-2].strip()
|
||||
if line.startswith('MAINTAINER'):
|
||||
|
|
Loading…
Reference in a new issue