Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 73 lines (62 sloc) 1.57 KB
#!/usr/bin/env python3
from utils.settings import env_file, BASE_DIR, load_config, create_docker_env_file
from pathlib import Path
import shutil
import os
def rm_dir(
path
):
print( "removing dir '{}'".format( path ) )
shutil.rmtree(
path,
ignore_errors=True
)
def rm_file(
path
):
if path.is_file():
print( "removing file '{}'".format( path ) )
path.unlink()
if __name__ == '__main__':
from argparse import ArgumentParser
if not env_file.exists():
create_docker_env_file()
config = load_config()
parser = ArgumentParser(
description="clean up the repository"
)
parser.add_argument(
"-d", "--deps",
action = "store_true",
help = "remove dependencies",
)
parser.add_argument(
"-r", "--runtime",
action = "store_true",
help = "remove '{rt_dir}'".format( rt_dir = BASE_DIR / config['RUNTIME_DIR'] ),
)
parser.add_argument(
"-e", "--env",
action = "store_true",
help = "remove existing .env file",
)
parser.add_argument(
"--all",
action = "store_true",
help = "purge in every way",
)
args = parser.parse_args()
from stop import stop
stop( config )
if args.deps or args.all:
rm_dir(
path = BASE_DIR / config['DEPENDENCIES_DIR']
)
if args.runtime or args.all:
rm_dir(
path = BASE_DIR / config['RUNTIME_DIR']
)
if args.env or args.all:
rm_file(
env_file
)