From 02a67877e808bf2f3cf637bcc5694907ae6c2f00 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 18 Sep 2020 15:00:19 +0100 Subject: shave off some duplicated code --- src/backend/metadata.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/backend') diff --git a/src/backend/metadata.py b/src/backend/metadata.py index a27e06a..99384a0 100644 --- a/src/backend/metadata.py +++ b/src/backend/metadata.py @@ -6,7 +6,7 @@ import shutil import subprocess import sisyphus.filesystem -def regenSilent(): +def regenMetadata(): if os.path.isdir(sisyphus.filesystem.portageMetadataDir): for files in os.listdir(sisyphus.filesystem.portageMetadataDir): if os.path.isfile(os.path.join(sisyphus.filesystem.portageMetadataDir, files)): @@ -19,16 +19,9 @@ def regenSilent(): portageExecStage2 = subprocess.Popen(['emerge', '--quiet', '--metadata'], stdout=subprocess.PIPE) portageExecStage2.wait() -@animation.wait("refreshing metadata") -def regenAnimated(): - if os.path.isdir(sisyphus.filesystem.portageMetadataDir): - for files in os.listdir(sisyphus.filesystem.portageMetadataDir): - if os.path.isfile(os.path.join(sisyphus.filesystem.portageMetadataDir, files)): - os.remove(os.path.join(sisyphus.filesystem.portageMetadataDir, files)) - else: - shutil.rmtree(os.path.join(sisyphus.filesystem.portageMetadataDir, files)) +def regenSilent(): + regenMetadata() - portageExecStage1 = subprocess.Popen(['emerge', '--quiet', '--regen'], stdout=subprocess.PIPE) - portageExecStage1.wait() - portageExecStage2 = subprocess.Popen(['emerge', '--quiet', '--metadata'], stdout=subprocess.PIPE) - portageExecStage2.wait() +@animation.wait("regenerating package metadata") +def regenAnimated(): + regenMetadata() -- cgit v1.2.3