Skip to content

Commit

Permalink
arch-update: add yay support for aur packages (vivien#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntibi committed May 13, 2022
1 parent 46cdab5 commit 719da43
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions arch-update/arch-update
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def create_argparse():
default = _default('AUR', 'False', strbool),
help='Include AUR packages. Attn: Yaourt must be installed'
)
parser.add_argument(
'-y',
'--aur_yay',
action = 'store_const',
const = True,
default = _default('AUR_YAY', 'False', strbool),
help='Include AUR packages. Attn: Yay must be installed'
)
parser.add_argument(
'-q',
'--quiet',
Expand Down Expand Up @@ -80,7 +88,7 @@ def get_updates():
return updates


def get_aur_updates():
def get_aur_yaourt_updates():
output = ''
try:
output = check_output(['yaourt', '-Qua']).decode('utf-8')
Expand All @@ -98,6 +106,15 @@ def get_aur_updates():

return aur_updates

def get_aur_yay_updates():
output = check_output(['yay', '-Qua']).decode('utf-8')
if not output:
return []

aur_updates = [line.split(' ')[0] for line in output.split('\n') if line]

return aur_updates


def matching_updates(updates, watch_list):
matches = set()
Expand All @@ -115,7 +132,9 @@ args = create_argparse()

updates = get_updates()
if args.aur:
updates += get_aur_updates()
updates += get_aur_yaourt_updates()
elif args.aur_yay:
updates += get_aur_yay_updates()

update_count = len(updates)
if update_count > 0:
Expand Down

0 comments on commit 719da43

Please sign in to comment.