feat: Indicate dependency source

Dependencies might reside in the AUR or official repositories.
Add "AUR" as superscript letters to indicate if a package/provider
is present in the AUR.

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2023-09-03 14:17:11 +02:00
parent 1433553c05
commit 0a7b02956f
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
5 changed files with 72 additions and 7 deletions

View file

@ -57,14 +57,17 @@ class PackageDependency(Base):
params=("NULL"),
)
def is_package(self) -> bool:
def is_aur_package(self) -> bool:
pkg = db.query(_Package).filter(_Package.Name == self.DepName).exists()
return db.query(pkg).scalar()
def is_package(self) -> bool:
official = (
db.query(_OfficialProvider)
.filter(_OfficialProvider.Name == self.DepName)
.exists()
)
return db.query(pkg).scalar() or db.query(official).scalar()
return self.is_aur_package() or db.query(official).scalar()
def provides(self) -> list[PackageRelation]:
from aurweb.models.relation_type import PROVIDES_ID