From ee9569cc21b77051a45a5841f667ed430c4a33c7 Mon Sep 17 00:00:00 2001 From: wulei05 Date: Tue, 6 Aug 2024 10:26:19 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=20=E5=85=88=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=8E=89pipline"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c0714f47a2038dce6da9ea7aebe383ee7c61c090. --- .../workflow/config_stub.py | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/NLiteAVDemo-Android-Java/workflow/config_stub.py b/NLiteAVDemo-Android-Java/workflow/config_stub.py index 6e0d1f5..895a9dd 100644 --- a/NLiteAVDemo-Android-Java/workflow/config_stub.py +++ b/NLiteAVDemo-Android-Java/workflow/config_stub.py @@ -1,38 +1,38 @@ -# import re -# import sys -# import os -# -# APP_CONFIG_FILE = sys.argv[1] -# APP_KEY = sys.argv[2] -# BASE_URL = sys.argv[3] -# -# -# # Stub a string with a evironment variable -# def stubString(searchPattern, rejectPattern, searchtText, replacement, desc): -# searchRet = re.search(searchPattern, searchtText).group() -# if re.search("\"{}\"".format(rejectPattern), searchRet) is not None: -# print -# "A valid {} is submitted!".format(desc) -# sys.exit(1) -# -# # Stub valid key and write back -# ret = re.sub('\"\S+\"', "\"{}\"".format(replacement), searchRet) -# ret = re.sub(searchPattern, ret, searchtText) -# return ret -# -# -# # Read heaer file -# -# io = open(APP_CONFIG_FILE, "r+") -# text = io.read() -# -# ret = stubString("std::string\sappKey\s?=\s?\"\S*\";", "^[a-f0-9]{32}$", text, APP_KEY, 'APP_KEY') -# ret = stubString("std::string\sbaseURL\s?=\s?\"\S*\";", -# "(?:rtmp:\/\/)[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+", ret, -# BASE_URL, 'BASE_URL') -# -# io.seek(0) -# io.write(ret) -# io.truncate() -# -# io.close() +import re +import sys +import os + +APP_CONFIG_FILE = sys.argv[1] +APP_KEY = sys.argv[2] +BASE_URL = sys.argv[3] + + +# Stub a string with a evironment variable +def stubString(searchPattern, rejectPattern, searchtText, replacement, desc): + searchRet = re.search(searchPattern, searchtText).group() + if re.search("\"{}\"".format(rejectPattern), searchRet) is not None: + print + "A valid {} is submitted!".format(desc) + sys.exit(1) + + # Stub valid key and write back + ret = re.sub('\"\S+\"', "\"{}\"".format(replacement), searchRet) + ret = re.sub(searchPattern, ret, searchtText) + return ret + + +# Read heaer file + +io = open(APP_CONFIG_FILE, "r+") +text = io.read() + +ret = stubString("std::string\sappKey\s?=\s?\"\S*\";", "^[a-f0-9]{32}$", text, APP_KEY, 'APP_KEY') +ret = stubString("std::string\sbaseURL\s?=\s?\"\S*\";", + "(?:rtmp:\/\/)[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+", ret, + BASE_URL, 'BASE_URL') + +io.seek(0) +io.write(ret) +io.truncate() + +io.close()