forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull request #25: Competitor removal scripts
Merge in WMN_TOOLS/matter from competitor_removal_scripts to silabs Squashed commit of the following: commit 5862e9089c529fd0c62caca90b90048b0fe35b61 Author: jepenven-silabs <[email protected]> Date: Thu Jul 21 15:29:26 2022 -0400 renamed commit 1db5a5d042fc0a6e8f11e6d0b3557392e880b429 Author: jepenven-silabs <[email protected]> Date: Wed Jul 20 08:34:47 2022 -0400 Add Script to clean Repo of competitor implementation/submodule
- Loading branch information
1 parent
f039a41
commit 3633029
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
####Imports | ||
import subprocess | ||
import sys | ||
import json | ||
import os | ||
import glob | ||
from pathlib import Path | ||
import shutil | ||
|
||
|
||
# To be run in the root of the matter folder | ||
|
||
# Defines | ||
git_remove_submodules_commands = ["git rm ./third_party/{path}/repo*", "rm -rf .git/modules/{path}", "git config --remove-section submodule.{path}/repo*", "rm -rf ./third_party/{path}"] | ||
git_submodule_to_remove = ["ameba", "bouffalolab", "cyw30739_sdk", "mbed-os-cypress-capsense-button", "mbed-mcu-boot", "mbed-os", "mbed-os-posix-socket", "nxp", "p6", "qpg_sdk", "simw-top-mini", "telink_sdk", "ti_simplelink_sdk", "tizen"] | ||
folder_to_remove = ["Ameba", "CYW30739", "ESP32", "P6", "Tizen", "bouffalolab", "cc13x2_26x2", "cc32xx", "nrfconnect", "nxp", "qpg", "telink"] | ||
examples_to_remove = folder_to_remove + ["mbed", "cc13x2x7_26x2x7"] | ||
|
||
def remove_submodules(): | ||
for module_name in git_submodule_to_remove: | ||
print("removing module " + module_name) | ||
for command in git_remove_submodules_commands: | ||
|
||
c = command.format(path=module_name) | ||
print("Running : " + c) | ||
try: | ||
subprocess.check_output(c, shell=True) | ||
except subprocess.CalledProcessError as e: | ||
print(e.output) | ||
|
||
try: | ||
subprocess.check_output("git commit -a -m \"Remove Submodules\"", shell=True) | ||
except subprocess.CalledProcessError as e: | ||
exit(1) | ||
|
||
|
||
def clean_platform(): | ||
for folder in folder_to_remove: | ||
shutil.rmtree("./src/platform/{name}".format(name=folder)) | ||
|
||
try: | ||
subprocess.check_output("git commit -a -m \"Remove Platform Folders\"", shell=True) | ||
except subprocess.CalledProcessError as e: | ||
exit(1) | ||
|
||
def clean_examples(): | ||
for example in glob.glob("./examples/*"): | ||
for platform in glob.glob(example + "/*"): | ||
for competitor in map(str.lower, examples_to_remove): | ||
if competitor in platform: | ||
if os.path.isdir(platform): | ||
shutil.rmtree(platform) | ||
else: | ||
os.remove(platform) | ||
try: | ||
subprocess.check_output("git commit -a -m \"Remove Competitors examples\"", shell=True) | ||
except subprocess.CalledProcessError as e: | ||
exit(1) | ||
|
||
|
||
remove_submodules() | ||
clean_platform() | ||
clean_examples() | ||
|