mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
Fix for check the database
This commit is contained in:
parent
0d036c5d08
commit
7ca08f18e3
2 changed files with 10 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.error_messages import Errors
|
||||
|
@ -42,3 +44,10 @@ class Check(Configs):
|
|||
if not_found:
|
||||
self.errors.raise_error_message(f'Not found \'{", ".join(not_found)}\' installed packages',
|
||||
exit_status=1)
|
||||
|
||||
def is_data_file_exist(self):
|
||||
json_data_file: Path = Path(f'{self.repos.repositories_path}/{self.repository}', self.repos.json_file)
|
||||
if not json_data_file.is_file():
|
||||
print("\nNeed to update the database first, please run:\n")
|
||||
print(f"{'':>2} $ slpkg update\n")
|
||||
raise SystemExit(1)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from slpkg.checks import Check
|
||||
|
@ -301,6 +300,7 @@ class Menu(Configs):
|
|||
|
||||
def load_database(self):
|
||||
if self.repository != '*' and not self.data:
|
||||
self.check.is_data_file_exist()
|
||||
print('\rDatabase loading... ', end='')
|
||||
|
||||
json_file: Path = Path(f'{self.repos.repositories_path}/{self.repository}', self.repos.json_file)
|
||||
|
|
Loading…
Reference in a new issue