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/branchreset.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/branchreset.py')
-rw-r--r-- | src/backend/branchreset.py | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/backend/branchreset.py b/src/backend/branchreset.py index 6168a25..def225a 100644 --- a/src/backend/branchreset.py +++ b/src/backend/branchreset.py @@ -3,36 +3,33 @@ import animation import os import shutil - -gentooEbuildDir = '/usr/ports/gentoo' -redcoreEbuildDir = '/usr/ports/redcore' -portageConfigDir = '/opt/redcore-build' +import sisyphus.filesystem @animation.wait('resetting branch configuration') def start(): - if os.path.isdir(gentooEbuildDir): - for files in os.listdir(gentooEbuildDir): - if os.path.isfile(os.path.join(gentooEbuildDir, files)): - os.remove(os.path.join(gentooEbuildDir, files)) + if os.path.isdir(sisyphus.filesystem.gentooEbuildDir): + for files in os.listdir(sisyphus.filesystem.gentooEbuildDir): + if os.path.isfile(os.path.join(sisyphus.filesystem.gentooEbuildDir, files)): + os.remove(os.path.join(sisyphus.filesystem.gentooEbuildDir, files)) else: - shutil.rmtree(os.path.join(gentooEbuildDir, files)) + shutil.rmtree(os.path.join(sisyphus.filesystem.gentooEbuildDir, files)) else: - os.makedirs(gentooEbuildDir) + os.makedirs(sisyphus.filesystem.gentooEbuildDir) - if os.path.isdir(redcoreEbuildDir): - for files in os.listdir(redcoreEbuildDir): - if os.path.isfile(os.path.join(redcoreEbuildDir, files)): - os.remove(os.path.join(redcoreEbuildDir, files)) + if os.path.isdir(sisyphus.filesystem.redcoreEbuildDir): + for files in os.listdir(sisyphus.filesystem.redcoreEbuildDir): + if os.path.isfile(os.path.join(sisyphus.filesystem.redcoreEbuildDir, files)): + os.remove(os.path.join(sisyphus.filesystem.redcoreEbuildDir, files)) else: - shutil.rmtree(os.path.join(redcoreEbuildDir, files)) + shutil.rmtree(os.path.join(sisyphus.filesystem.redcoreEbuildDir, files)) else: - os.makedirs(redcoreEbuildDir) + os.makedirs(sisyphus.filesystem.redcoreEbuildDir) - if os.path.isdir(portageConfigDir): - for files in os.listdir(portageConfigDir): - if os.path.isfile(os.path.join(portageConfigDir, files)): - os.remove(os.path.join(portageConfigDir, files)) + if os.path.isdir(sisyphus.filesystem.portageConfigDir): + for files in os.listdir(sisyphus.filesystem.portageConfigDir): + if os.path.isfile(os.path.join(sisyphus.filesystem.portageConfigDir, files)): + os.remove(os.path.join(sisyphus.filesystem.portageConfigDir, files)) else: - shutil.rmtree(os.path.join(portageConfigDir, files)) + shutil.rmtree(os.path.join(sisyphus.filesystem.portageConfigDir, files)) else: - os.makedirs(portageConfigDir) + os.makedirs(sisyphus.filesystem.portageConfigDir) |