mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-05 11:02:14 +01:00
Switched with sqlite
This commit is contained in:
parent
272cddfb03
commit
f90780102f
1 changed files with 12 additions and 11 deletions
|
@ -22,7 +22,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from slpkg.utils import Utils
|
||||
import sqlite3
|
||||
from slpkg.repositories import Repo
|
||||
from slpkg.__metadata__ import MetaData as _meta_
|
||||
|
||||
|
@ -33,16 +33,17 @@ def sbo_search_pkg(name):
|
|||
"""Search for package path in SLACKBUILDS.TXT file and
|
||||
return url
|
||||
"""
|
||||
url = ""
|
||||
utils = Utils()
|
||||
db = _meta_.db
|
||||
lib_path = _meta_.lib_path
|
||||
con = sqlite3.connect(f"{lib_path}{db}")
|
||||
cur = con.cursor()
|
||||
|
||||
loc = cur.execute("""SELECT location
|
||||
FROM sbo
|
||||
WHERE name = '{}'""".format(name)).fetchone()
|
||||
|
||||
repo = Repo()
|
||||
sbo = repo.default_repository()["sbo"]
|
||||
sbo_url = f"{sbo}{slack_ver()}/"
|
||||
SLACKBUILDS_TXT = utils.read_file(
|
||||
f"{_meta_.lib_path}sbo_repo/SLACKBUILDS.TXT")
|
||||
for line in SLACKBUILDS_TXT.splitlines():
|
||||
if line.startswith("SLACKBUILD LOCATION"):
|
||||
sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
|
||||
if name == sbo_name:
|
||||
url = f"{sbo_url}{line[23:].strip()}/"
|
||||
return url
|
||||
|
||||
return f"{sbo_url}{loc[0][2:]}/"
|
||||
|
|
Loading…
Reference in a new issue