diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-06-06 20:37:56 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-06-06 20:37:56 +0100 |
commit | ed88746cd33c0f861e9c45bf05bf9e44d86089ba (patch) | |
tree | e6656f3d54bd738383d048c744d330dca2c15e4c /src/backend/metadata.py | |
parent | 2d86cd9ddc5d9442e4a8e8fb50d72480a8293a4a (diff) |
filesystem module : gather all the folder and file paths used by sisyphus under one module, and expose them to other modules from there
Diffstat (limited to 'src/backend/metadata.py')
-rw-r--r-- | src/backend/metadata.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/backend/metadata.py b/src/backend/metadata.py index fc30b15..a27e06a 100644 --- a/src/backend/metadata.py +++ b/src/backend/metadata.py @@ -4,16 +4,15 @@ import animation import os import shutil import subprocess - -portageMetadataDir = '/var/cache/edb' +import sisyphus.filesystem def regenSilent(): - if os.path.isdir(portageMetadataDir): - for files in os.listdir(portageMetadataDir): - if os.path.isfile(os.path.join(portageMetadataDir, files)): - os.remove(os.path.join(portageMetadataDir, files)) + 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(portageMetadataDir, files)) + shutil.rmtree(os.path.join(sisyphus.filesystem.portageMetadataDir, files)) portageExecStage1 = subprocess.Popen(['emerge', '--quiet', '--regen'], stdout=subprocess.PIPE) portageExecStage1.wait() @@ -22,12 +21,12 @@ def regenSilent(): @animation.wait("refreshing metadata") def regenAnimated(): - if os.path.isdir(portageMetadataDir): - for files in os.listdir(portageMetadataDir): - if os.path.isfile(os.path.join(portageMetadataDir, files)): - os.remove(os.path.join(portageMetadataDir, files)) + 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(portageMetadataDir, files)) + shutil.rmtree(os.path.join(sisyphus.filesystem.portageMetadataDir, files)) portageExecStage1 = subprocess.Popen(['emerge', '--quiet', '--regen'], stdout=subprocess.PIPE) portageExecStage1.wait() |