Skip to content

Commit

Permalink
Make clean_artefacts() nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Sep 13, 2022
1 parent 4c8b832 commit d51ccf9
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions setupsrc/pl_setup/packaging_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,19 @@ def call_ctypesgen(target_dir, include_dir):

def clean_artefacts():

# TODO(#136@geisserml) Improve robustness.
deletables = [
join(SourceTree, "build"),
join(ModuleDir, BindingsFileName),
]
deletables += [join(ModuleDir, fn) for fn in MainLibnames]

build_cache = join(SourceTree, "build")
if os.path.exists(build_cache):
shutil.rmtree(build_cache)

deletable_files = [join(ModuleDir, n) for n in (*MainLibnames, BindingsFileName)]
for file in deletable_files:
if os.path.exists(file):
os.remove(file)
for item in deletables:
if not os.path.exists(item):
continue
if os.path.isfile(item):
os.remove(item)
elif os.path.isdir(item):
shutil.rmtree(item)


def copy_platfiles(pl_name):
Expand Down

0 comments on commit d51ccf9

Please sign in to comment.