Skip to content

Commit

Permalink
Improve housekeep.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pepoluan committed Jan 17, 2023
1 parent 1dd5276 commit 5f3557c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion housekeep.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ def deldir(targ: Path, verbose: bool = True):


def dump_env():
env = dict(os.environ)
env["PYTHON_EXE"] = str(sys.executable)
dumpdir = Path(DUMP_DIR)
dumpdir.mkdir(exist_ok=True)
with (dumpdir / f"ENV.{TOX_ENV_NAME}.py").open("wt") as fout:
print("ENV = \\", file=fout)
pprint.pprint(dict(os.environ), stream=fout)
pprint.pprint(env, stream=fout)


def move_prof(verbose: bool = False):
Expand Down Expand Up @@ -141,6 +143,18 @@ def pycache_clean(verbose=False):
print(flush=True)


def docs_clean(verbose=False):
"""Cleanup build/ to force sphinx-build to rebuild"""
buildpath = Path("build")
if not buildpath.exists():
print("Docs already cleaned.")
return
print("Removing build/ ...", end="")
deldir(buildpath, verbose)
if verbose:
print(flush=True)


def rm_work():
"""Remove work dirs & files. They are .gitignore'd anyways."""
print(f"{Style.BRIGHT}Removing work dirs ... ", end="", flush=True)
Expand Down Expand Up @@ -185,6 +199,13 @@ def dispatch_remcache():
pycache_clean()


def dispatch_remdocs():
"""
Remove all docs artefacts
"""
docs_clean()


def dispatch_superclean():
"""
Total cleaning of all test artifacts
Expand Down

0 comments on commit 5f3557c

Please sign in to comment.