xref: /btstack/port/samv71-xplained-atwilc3000/scripts/delete_examples.py (revision 6ccd8248590f666db07dd7add13fecb4f5664fb5)
1*6ccd8248SMilanka Ringwald#!/usr/bin/env python3
20af04ee4SMatthias Ringwald#
30af04ee4SMatthias Ringwald# Delete project files for all BTstack embedded examples in local port/esp32 folder
40af04ee4SMatthias Ringwald
50af04ee4SMatthias Ringwaldimport os
60af04ee4SMatthias Ringwaldimport shutil
70af04ee4SMatthias Ringwaldimport sys
80af04ee4SMatthias Ringwaldimport time
90af04ee4SMatthias Ringwaldimport subprocess
100af04ee4SMatthias Ringwald
110af04ee4SMatthias Ringwald# get script path
120af04ee4SMatthias Ringwaldscript_path = os.path.abspath(os.path.dirname(sys.argv[0]))
130af04ee4SMatthias Ringwald
140af04ee4SMatthias Ringwald# path to examples
150af04ee4SMatthias Ringwaldexamples_embedded = script_path + "/../../../example/"
160af04ee4SMatthias Ringwald
170af04ee4SMatthias Ringwald# path to port/esp32
180af04ee4SMatthias Ringwaldapps_btstack = "example/"
190af04ee4SMatthias Ringwald
200af04ee4SMatthias Ringwaldprint("Deleting examples in local folder")
210af04ee4SMatthias Ringwald
220af04ee4SMatthias Ringwald# iterate over btstack examples
230af04ee4SMatthias Ringwaldfor file in os.listdir(examples_embedded):
240af04ee4SMatthias Ringwald    if not file.endswith(".c"):
250af04ee4SMatthias Ringwald        continue
260af04ee4SMatthias Ringwald    example = file[:-2]
270af04ee4SMatthias Ringwald    apps_folder = apps_btstack + example + "/"
280af04ee4SMatthias Ringwald    if os.path.exists(apps_folder):
290af04ee4SMatthias Ringwald        shutil.rmtree(apps_folder)
300af04ee4SMatthias Ringwald    print("- %s" % example)
310af04ee4SMatthias Ringwald
32