xref: /btstack/port/samv71-xplained-atwilc3000/scripts/delete_examples.py (revision 0af04ee4d37be8d9457648a5a7a21f3a4ff171da)
1*0af04ee4SMatthias Ringwald#!/usr/bin/env python
2*0af04ee4SMatthias Ringwald#
3*0af04ee4SMatthias Ringwald# Delete project files for all BTstack embedded examples in local port/esp32 folder
4*0af04ee4SMatthias Ringwald
5*0af04ee4SMatthias Ringwaldimport os
6*0af04ee4SMatthias Ringwaldimport shutil
7*0af04ee4SMatthias Ringwaldimport sys
8*0af04ee4SMatthias Ringwaldimport time
9*0af04ee4SMatthias Ringwaldimport subprocess
10*0af04ee4SMatthias Ringwald
11*0af04ee4SMatthias Ringwald# get script path
12*0af04ee4SMatthias Ringwaldscript_path = os.path.abspath(os.path.dirname(sys.argv[0]))
13*0af04ee4SMatthias Ringwald
14*0af04ee4SMatthias Ringwald# path to examples
15*0af04ee4SMatthias Ringwaldexamples_embedded = script_path + "/../../../example/"
16*0af04ee4SMatthias Ringwald
17*0af04ee4SMatthias Ringwald# path to port/esp32
18*0af04ee4SMatthias Ringwaldapps_btstack = "example/"
19*0af04ee4SMatthias Ringwald
20*0af04ee4SMatthias Ringwaldprint("Deleting examples in local folder")
21*0af04ee4SMatthias Ringwald
22*0af04ee4SMatthias Ringwald# iterate over btstack examples
23*0af04ee4SMatthias Ringwaldfor file in os.listdir(examples_embedded):
24*0af04ee4SMatthias Ringwald    if not file.endswith(".c"):
25*0af04ee4SMatthias Ringwald        continue
26*0af04ee4SMatthias Ringwald    example = file[:-2]
27*0af04ee4SMatthias Ringwald    apps_folder = apps_btstack + example + "/"
28*0af04ee4SMatthias Ringwald    if os.path.exists(apps_folder):
29*0af04ee4SMatthias Ringwald        shutil.rmtree(apps_folder)
30*0af04ee4SMatthias Ringwald    print("- %s" % example)
31*0af04ee4SMatthias Ringwald
32