This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add noqa to skip specific platform, close #199
- Loading branch information
Showing
2 changed files
with
65 additions
and
25 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
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,44 @@ | ||
# -*- utf-8 -*- | ||
# author: eritque-arcus | ||
# date: 08/21/23 | ||
|
||
import sys, json, regex | ||
|
||
def genMatrix(msg: str): | ||
global winOS, linuxOS | ||
matrix = { | ||
"os":[winOS, linuxOS], | ||
"include":[ | ||
{"os": winOS, "targetName": "MSVCX64"}, | ||
{"os": linuxOS, "targetName": "LinuxX64"} | ||
] | ||
} | ||
if msg.endswith("noqa"): | ||
matrix = {"os": []} | ||
else: | ||
re = regex.findall(R"noqa\(([a-z,]+)\)$", msg)[0] | ||
if re is not None: | ||
OSs = re.split(',') | ||
for OS in OSs: | ||
if OS == "win" or OS == "windows": | ||
matrix["os"].remove(winOS) | ||
matrix["include"] = [item for item in matrix["include"] if item["os"] != winOS] | ||
elif OS == "linux": | ||
matrix["os"].remove(linuxOS) | ||
matrix["include"] = [item for item in matrix["include"] if item["os"] != linuxOS] | ||
else: | ||
print("Error: Can't find specific noqa OS name:" + OS +"!!!!", file=sys.stderr) | ||
print("matrix=" + json.dumps(matrix)) | ||
|
||
if __name__ == "__main__": | ||
winOS = "windows-2019" | ||
linuxOS = "ubuntu-20.04" | ||
args = sys.argv | ||
assert(len(args) >= 2) | ||
cmd = args[1] | ||
if cmd == "genMatrix": | ||
assert(len(args) == 3) | ||
genMatrix(args[2]) | ||
else: | ||
print("cmd not match!", file=sys.stderr) | ||
exit(1) |