From d3c251a6dbbe4698749939d3fcf26a21bff790fa Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 29 May 2022 20:20:01 +0300 Subject: [PATCH] Redefined database path --- slpkg/__metadata__.py | 2 +- slpkg/init.py | 5 ++--- slpkg/models/models.py | 2 +- slpkg/sbo/greps.py | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 9751d6d6..11728094 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -242,7 +242,7 @@ class MetaData: slackpkg_lib_path = "/var/lib/slackpkg/" # database name - db = "database.slpkg" + db = "/database/database.slpkg" # computer architecture if comp_arch in ["off", "OFF"]: diff --git a/slpkg/init.py b/slpkg/init.py index e1e2fbaa..8e404959 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -81,10 +81,9 @@ class Initialization(Utils): def database(self): """Initializing the database """ - self.db = "database.slpkg" - db_lib = self.lib_path + "database/" + db_lib = self.lib_path + self.meta.db self.make_dirs([db_lib]) - self.con = sqlite3.connect(db_lib + self.db) + self.con = sqlite3.connect(db_lib) self.cur = self.con.cursor() def make_dir(self, path: list): diff --git a/slpkg/models/models.py b/slpkg/models/models.py index 37de4dc8..85e63111 100644 --- a/slpkg/models/models.py +++ b/slpkg/models/models.py @@ -34,7 +34,7 @@ class Database: self.table_name = table_name self.text_file = text_file self.db = _meta_.db - self.con = sqlite3.connect(f"{self.lib_path}database/{self.db}") + self.con = sqlite3.connect(f"{self.lib_path}{self.db}") self.cur = self.con.cursor() def table_exists(self): diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/greps.py index 4de60ba4..611f4322 100644 --- a/slpkg/sbo/greps.py +++ b/slpkg/sbo/greps.py @@ -35,7 +35,7 @@ class SBoGrep(Utils): self.meta = _meta_ self.db = self.meta.db self.arch64 = "x86_64" - self.sbo_db = f"{self.meta.lib_path}database/{self.db}" + self.sbo_db = f"{self.meta.lib_path}{self.db}" self.con = sqlite3.connect(self.sbo_db) self.cur = self.con.cursor()