mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
[packages] Change callbacks
This commit is contained in:
parent
fa10bb8dd3
commit
e1e29780f2
1 changed files with 5 additions and 5 deletions
|
@ -406,13 +406,13 @@ class PMPacman(PackageManager):
|
||||||
# These are globals
|
# These are globals
|
||||||
self.progress_fraction = (completed_packages * 1.0 / total_packages)
|
self.progress_fraction = (completed_packages * 1.0 / total_packages)
|
||||||
|
|
||||||
def run_pacman(self, command):
|
def run_pacman(self, command, callback=None):
|
||||||
# Call pacman in a loop until it is successful or the number of retries is exceeded
|
# Call pacman in a loop until it is successful or the number of retries is exceeded
|
||||||
pacman_count = 0
|
pacman_count = 0
|
||||||
while pacman_count <= self.pacman_num_retries:
|
while pacman_count <= self.pacman_num_retries:
|
||||||
pacman_count += 1
|
pacman_count += 1
|
||||||
try:
|
try:
|
||||||
libcalamares.utils.target_env_process_output(command, self.line_cb)
|
libcalamares.utils.target_env_process_output(command, callback)
|
||||||
return
|
return
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
if pacman_count <= self.pacman_num_retries:
|
if pacman_count <= self.pacman_num_retries:
|
||||||
|
@ -438,13 +438,13 @@ class PMPacman(PackageManager):
|
||||||
|
|
||||||
command += pkgs
|
command += pkgs
|
||||||
|
|
||||||
self.run_pacman(command)
|
self.run_pacman(command, self.line_cb)
|
||||||
|
|
||||||
self.reset_progress()
|
self.reset_progress()
|
||||||
|
|
||||||
def remove(self, pkgs):
|
def remove(self, pkgs):
|
||||||
self.reset_progress()
|
self.reset_progress()
|
||||||
self.run_pacman(["pacman", "-Rs", "--noconfirm"] + pkgs)
|
self.run_pacman(["pacman", "-Rs", "--noconfirm"] + pkgs, self.line_cb)
|
||||||
|
|
||||||
def update_db(self):
|
def update_db(self):
|
||||||
self.run_pacman(["pacman", "-Sy"])
|
self.run_pacman(["pacman", "-Sy"])
|
||||||
|
@ -454,7 +454,7 @@ class PMPacman(PackageManager):
|
||||||
if self.pacman_disable_timeout is True:
|
if self.pacman_disable_timeout is True:
|
||||||
command.append("--disable-download-timeout")
|
command.append("--disable-download-timeout")
|
||||||
|
|
||||||
self.run_pacman(command)
|
self.run_pacman(command, self.line_cb)
|
||||||
|
|
||||||
|
|
||||||
class PMPamac(PackageManager):
|
class PMPamac(PackageManager):
|
||||||
|
|
Loading…
Add table
Reference in a new issue