From ac0efd1bd6c703147bd8d3caedf489fab87d6131 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 6 Jun 2020 16:22:04 +0100 Subject: big rewrite : split the backend in smaller pieces, rework the cli frontend to work with the new backend ... gui frontend wip --- src/backend/branchreset.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/backend/branchreset.py (limited to 'src/backend/branchreset.py') diff --git a/src/backend/branchreset.py b/src/backend/branchreset.py new file mode 100644 index 0000000..6168a25 --- /dev/null +++ b/src/backend/branchreset.py @@ -0,0 +1,38 @@ +#!/usr/bin/python3 + +import animation +import os +import shutil + +gentooEbuildDir = '/usr/ports/gentoo' +redcoreEbuildDir = '/usr/ports/redcore' +portageConfigDir = '/opt/redcore-build' + +@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)) + else: + shutil.rmtree(os.path.join(gentooEbuildDir, files)) + else: + os.makedirs(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)) + else: + shutil.rmtree(os.path.join(redcoreEbuildDir, files)) + else: + os.makedirs(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)) + else: + shutil.rmtree(os.path.join(portageConfigDir, files)) + else: + os.makedirs(portageConfigDir) -- cgit v1.2.3