mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 21:14:15 +02:00
[improvement][aur] retrieving and displaying all transitive required dependencies
This commit is contained in:
@@ -4,6 +4,8 @@ from typing import Set, List
|
||||
from bauh.api.http import HttpClient
|
||||
import urllib.parse
|
||||
|
||||
from bauh.gems.arch.exceptions import PackageNotFoundException
|
||||
|
||||
URL_INFO = 'https://aur.archlinux.org/rpc/?v=5&type=info&'
|
||||
URL_SRC_INFO = 'https://aur.archlinux.org/cgit/aur.git/plain/.SRCINFO?h='
|
||||
URL_SEARCH = 'https://aur.archlinux.org/rpc/?v=5&type=search&arg='
|
||||
@@ -46,5 +48,18 @@ class AURClient:
|
||||
|
||||
return info
|
||||
|
||||
def get_all_dependencies(self, name: str) -> Set[str]:
|
||||
deps = set()
|
||||
info = self.get_src_info(name)
|
||||
|
||||
if not info:
|
||||
raise PackageNotFoundException(name)
|
||||
|
||||
for attr in ('makedepends', 'depends', 'checkdepends'):
|
||||
if info.get(attr):
|
||||
deps.update(info[attr])
|
||||
|
||||
return deps
|
||||
|
||||
def _map_names_as_queries(self, names) -> str:
|
||||
return '&'.join(['arg[{}]={}'.format(i, urllib.parse.quote(n)) for i, n in enumerate(names)])
|
||||
|
||||
Reference in New Issue
Block a user