diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-09-17 19:12:53 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-09-17 19:12:53 +0100 |
commit | e1562a71d6483021d332bccbfc5a3086688bc58c (patch) | |
tree | 6be3d468e0aadd6c4de6c4dbd7a58ebe9fd59cbb /src/backend/purgeEnvironment.py | |
parent | 0cf2c9f8ec52b1ae276c1573210d252ab0c4577b (diff) |
rearrange the backend
Diffstat (limited to 'src/backend/purgeEnvironment.py')
-rw-r--r-- | src/backend/purgeEnvironment.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/backend/purgeEnvironment.py b/src/backend/purgeEnvironment.py new file mode 100644 index 0000000..0eba801 --- /dev/null +++ b/src/backend/purgeEnvironment.py @@ -0,0 +1,51 @@ +#!/usr/bin/python3 + +import animation +import os +import shutil +import sisyphus.getFilesystem + +@animation.wait('purging branch configuration') +def branch(): + if os.path.isdir(sisyphus.getFilesystem.portageRepoDir): + for files in os.listdir(sisyphus.getFilesystem.portageRepoDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.portageRepoDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.portageRepoDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageRepoDir, files)) + else: + os.makedirs(sisyphus.getFilesystem.portageRepoDir) + + if os.path.isdir(sisyphus.getFilesystem.redcoreRepoDir): + for files in os.listdir(sisyphus.getFilesystem.redcoreRepoDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.redcoreRepoDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.redcoreRepoDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.redcoreRepoDir, files)) + else: + os.makedirs(sisyphus.getFilesystem.redcoreRepoDir) + + if os.path.isdir(sisyphus.getFilesystem.portageConfigDir): + for files in os.listdir(sisyphus.getFilesystem.portageConfigDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.portageConfigDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.portageConfigDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageConfigDir, files)) + else: + os.makedirs(sisyphus.getFilesystem.portageConfigDir) + +def cache(): + if os.path.isdir(sisyphus.getFilesystem.portageCacheDir): + for files in os.listdir(sisyphus.getFilesystem.portageCacheDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.portageCacheDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.portageCacheDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageCacheDir, files)) + +def metadata(): + if os.path.isdir(sisyphus.getFilesystem.portageMetadataDir): + for files in os.listdir(sisyphus.getFilesystem.portageMetadataDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.portageMetadataDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.portageMetadataDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageMetadataDir, files)) |