import subprocess
import re
from get_current_dir_path import *
+import config
# Function opens tct-mgr tool for to run tc
def tpk_build_install(PROCESS, TYPE_OF_TCs, MODULE_NAME, DEVICE_TYPE, ARCHITECTURE_TYPE):
lst = []
CURRENT_PATH = get_current_dir_path()
- command = f"echo 'Samsung@123' | sudo -S ./tpkbuild {PROCESS} {TYPE_OF_TCs} {MODULE_NAME} {DEVICE_TYPE} {ARCHITECTURE_TYPE} &"
+ command = f"echo {config.SYSTEM_PASSWORD} | sudo -S ./tpkbuild {PROCESS} {TYPE_OF_TCs} {MODULE_NAME} {DEVICE_TYPE} {ARCHITECTURE_TYPE} &"
process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True, cwd=CURRENT_PATH)
- proc_stdout = process.communicate(input='Samsung@123')[0]
+ proc_stdout = process.communicate(input=config.SYSTEM_PASSWORD)[0]
for line in proc_stdout.decode().split('\n'):
lst.append(line)
return "\n".join(lst)
from get_current_dir_path import *
import subprocess
+import config
def provide_permission(MODULE_NAME, CURRENT_PATH):
CURRENT_PATH = CURRENT_PATH + "/src/utc"
- command = f"echo 'Samsung@123' | sudo -S chmod -R 777 {MODULE_NAME} &"
+ command = f"echo {config.SYSTEM_PASSWORD} | sudo -S chmod -R 777 {MODULE_NAME} &"
process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True, cwd=CURRENT_PATH)
- process.communicate(input='Samsung@123')[0]
+ process.communicate(input=config.SYSTEM_PASSWORD)[0]
def new_module_addition(MODULE_NAME, TYPE_OF_TCs):
lst = []
CURRENT_PATH = get_current_dir_path()
- command = f"echo 'Samsung@123' | sudo -S ./tpkbuild addmod {TYPE_OF_TCs} {MODULE_NAME} &"
+ command = f"echo {config.SYSTEM_PASSWORD} | sudo -S ./tpkbuild addmod {TYPE_OF_TCs} {MODULE_NAME} &"
process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True, cwd=CURRENT_PATH)
- proc_stdout = process.communicate(input='Samsung@123')[0]
+ proc_stdout = process.communicate(input=config.SYSTEM_PASSWORD)[0]
for line in proc_stdout.decode().split('\n'):
lst.append(line)
provide_permission(MODULE_NAME, CURRENT_PATH)
if module_name_suggested == True:\r
last_stage_index = 1\r
if previous_intent == "removeapi":\r
- result = "Module name found" + "\n" + "Please enter the list of deprecated APIs which you want to be removed in the format of DELETE: API_NAME_1, API_NAME_2, API_NAME_3, etc.\n\n[ To navigate, please type 'Back' ]"\r
+ result = "Module name found" + "\n" + "Please enter the list of deprecated APIs which you want to be removed in the format of DELETE: API_NAME_1, API_NAME_2, API_NAME_3, etc.\n\nOR\n\nIf full module is to be deleted then type: DELETE: full_module\n\n[ To navigate, please type 'Back' ]"\r
previous_intent = 'modulename'\r
else:\r
result = "Module name found" + "\n" + result\r
MODULE_NAME = module_name.lower()\r
CURRENT_PATH = get_current_dir_path()\r
TC_DIR_PATH = CURRENT_PATH + r'src/utc/'\r
- REMOVE_TC_LIST, NOT_FOUND_API_LIST = deprecated_api_removal(MODULE_NAME, remove_api_names, TC_DIR_PATH)\r
- REMOVE_TC_LIST_NUMBERED = ""\r
- NOT_FOUND_API_LIST_NUMBERED = ""\r
- for i, item in enumerate(REMOVE_TC_LIST, start=1):\r
- REMOVE_TC_LIST_NUMBERED += f"{i}. {item}" + "\n"\r
- for i, item in enumerate(NOT_FOUND_API_LIST, start=1):\r
- NOT_FOUND_API_LIST_NUMBERED += f"{i}. {item}" + "\n"\r
-\r
- if len(REMOVE_TC_LIST) == 0:\r
- result = "TCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\n[ To navigate, please type 'Back' ]"\r
- elif len(REMOVE_TC_LIST) > 0 and len(NOT_FOUND_API_LIST) == 0:\r
- result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]"\r
- elif len(REMOVE_TC_LIST) > 0 and len(NOT_FOUND_API_LIST) > 0:\r
- result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nTCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]"\r
+ remove_api_names = remove_api_names.strip()\r
+ if remove_api_names == "full_module":\r
+ remove_complete_module(MODULE_NAME)\r
+ result = "Full module removed. \n\nType 'Exit' to close the tool."\r
else:\r
- result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nTCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]"\r
+ REMOVE_TC_LIST, NOT_FOUND_API_LIST = deprecated_api_removal(MODULE_NAME, remove_api_names, TC_DIR_PATH)\r
+ REMOVE_TC_LIST_NUMBERED = ""\r
+ NOT_FOUND_API_LIST_NUMBERED = ""\r
+ for i, item in enumerate(REMOVE_TC_LIST, start=1):\r
+ REMOVE_TC_LIST_NUMBERED += f"{i}. {item}" + "\n"\r
+ for i, item in enumerate(NOT_FOUND_API_LIST, start=1):\r
+ NOT_FOUND_API_LIST_NUMBERED += f"{i}. {item}" + "\n"\r
+\r
+ if len(REMOVE_TC_LIST) == 0:\r
+ result = "TCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\n[ To navigate, please type 'Back' ]"\r
+ elif len(REMOVE_TC_LIST) > 0 and len(NOT_FOUND_API_LIST) == 0:\r
+ result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]"\r
+ elif len(REMOVE_TC_LIST) > 0 and len(NOT_FOUND_API_LIST) > 0:\r
+ result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nTCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]"\r
+ else:\r
+ result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nTCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]"\r
\r
\r
elif intent == 'donotremove':\r