Merge pull request #666 from olekthunder/re_rank_mirrors_fix
Fix re_rank_mirrors
This commit is contained in:
commit
d25a20a7f2
|
|
@ -125,10 +125,17 @@ def use_mirrors(
|
|||
mirrorlist.write(f'Server = {mirror}\n')
|
||||
|
||||
|
||||
def re_rank_mirrors(top=10, *positionals, **kwargs):
|
||||
if SysCommand(f'/usr/bin/rankmirrors -n {top} /etc/pacman.d/mirrorlist > /etc/pacman.d/mirrorlist').exit_code == 0:
|
||||
return True
|
||||
return False
|
||||
def re_rank_mirrors(
|
||||
top: int = 10,
|
||||
src: str = '/etc/pacman.d/mirrorlist',
|
||||
dst: str = '/etc/pacman.d/mirrorlist',
|
||||
) -> bool:
|
||||
cmd = SysCommand(f"/usr/bin/rankmirrors -n {top} {src}")
|
||||
if cmd.exit_code != 0:
|
||||
return False
|
||||
with open(dst, 'w') as f:
|
||||
f.write(str(cmd))
|
||||
return True
|
||||
|
||||
|
||||
def list_mirrors(sort_order=["https", "http"]):
|
||||
|
|
|
|||
Loading…
Reference in New Issue