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