Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
test-vscode-c-win
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸大学计算机学院
教师群组
赵鹏翀-zpc
test-vscode-c-win
提交
15853da0
提交
15853da0
3月 24, 2021
创建
作者:
305350171@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交作业
上级
daa21943
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
45 行增加
和
33 行删除
+45
-33
tasks.json
.vscode/tasks.json
+3
-3
gitpush.py
gitpush.py
+19
-13
test.py
test.py
+23
-17
没有找到文件。
.vscode/tasks.json
浏览文件 @
15853da0
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
"problemMatcher"
:
"$msCompile"
"problemMatcher"
:
"$msCompile"
},
},
{
{
"label"
:
"安装p
ip包(setup pip package)
"
,
"label"
:
"安装p
ython包
"
,
"type"
:
"shell"
,
"type"
:
"shell"
,
"windows"
:
{
"windows"
:
{
"command"
:
"pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt"
"command"
:
"pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt"
...
@@ -82,10 +82,10 @@
...
@@ -82,10 +82,10 @@
"label"
:
"提交作业(git push)"
,
"label"
:
"提交作业(git push)"
,
"type"
:
"shell"
,
"type"
:
"shell"
,
"windows"
:
{
"windows"
:
{
"command"
:
"python
custom
gitpush.py"
"command"
:
"python gitpush.py"
},
},
"linux"
:
{
"linux"
:
{
"command"
:
"python3
custom
gitpush.py"
"command"
:
"python3 gitpush.py"
},
},
"args"
:
[],
"args"
:
[],
"group"
:
"build"
,
"group"
:
"build"
,
...
...
custom
gitpush.py
→
gitpush.py
浏览文件 @
15853da0
...
@@ -8,38 +8,43 @@ import filecmp
...
@@ -8,38 +8,43 @@ import filecmp
import
subprocess
import
subprocess
import
platform
import
platform
print
(
"************************************************************
\n
"
"如果下面报告类似 ImportError: No module named 'xxx' 的错误,
\n
"
"说明 python 运行环境中缺少必要的包。
\n
"
"此时可以启动
\"
安装python包
\"
任务来修复 python 运行环境(需要连接互联网)。
\n
"
"************************************************************
\n
"
)
from
colorama
import
Fore
,
init
,
AnsiToWin32
from
colorama
import
Fore
,
init
,
AnsiToWin32
init
(
wrap
=
False
)
init
(
wrap
=
False
)
stream
=
AnsiToWin32
(
sys
.
stderr
)
.
stream
stream
=
AnsiToWin32
(
sys
.
stderr
)
.
stream
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
print
(
Fore
.
GREEN
+
"customgitpush.py version: 1.0"
,
file
=
stream
)
print
(
"gitpush.py version: 1.0"
)
print
(
Fore
.
WHITE
,
file
=
stream
)
execResult
=
os
.
system
(
"git add . && git commit -m
\"
提交作业
\"
"
)
execResult
=
os
.
system
(
"git add . && git commit -m
\"
提交作业
\"
"
)
if
execResult
==
256
or
execResult
==
1
:
if
execResult
==
256
or
execResult
==
1
:
print
(
"
\n
-------- 本次提交没有任何变更,即使推送成功,也不代表远程一定有提交记录 --------"
)
print
(
"
\n
-------- 本次提交没有任何变更,即使推送成功,也不代表远程一定有提交记录 --------"
)
print
(
"-------- 请对项目中的文件进行修改后再进行提交-----------------------------------"
)
print
(
"-------- 请对项目中的文件进行修改后再进行提交-----------------------------------"
)
elif
execResult
==
128
:
elif
execResult
!=
0
:
print
(
"
\n
-------- 推送到 Git 远程库失败 --------"
)
print
(
Fore
.
RED
+
"
\n
-------- 提交作业失败! 错误码: {0}--------"
.
format
(
execResult
),
file
=
stream
)
print
(
Fore
.
WHITE
,
file
=
stream
)
exit
(
0
)
exit
(
0
)
print
(
"
\n
-------------------------------------------------------------------------------"
)
print
(
"
\n
-------------------------------------------------------------------------------"
)
print
(
"
当弹出命令面板时请分别输入 Git 远程库的用户名和密码。通常为 CodeCode
密码。"
)
print
(
"
请在 VSCode 顶部弹出的命令面板中输入 Git 远程库的用户名和密码。通常为 CodeCode 平台的用户名和
密码。"
)
print
(
"-------------------------------------------------------------------------------"
)
print
(
"-------------------------------------------------------------------------------"
)
print
(
Fore
.
GREEN
+
"正在提交作业..."
,
file
=
stream
)
print
(
Fore
.
WHITE
,
file
=
stream
)
sys
.
stdout
.
flush
()
execResult
=
os
.
system
(
"git push"
)
execResult
=
os
.
system
(
"git push"
)
if
execResult
==
0
:
if
execResult
==
0
:
print
(
"
\n
-------- 推送到 Git 远程库成功 --------"
)
print
(
Fore
.
GREEN
+
"
\n
-------- 提交作业成功! --------"
,
file
=
stream
)
print
(
Fore
.
WHITE
,
file
=
stream
)
else
:
else
:
print
(
"
\n
--- 推送到 Git 远程库失败!想解决推送到 Git 远程库失败问题?使用浏览器访问下面链接即可。 ---"
)
print
(
Fore
.
RED
+
"
\n
--- 提交作业失败! 想解决失败问题? 使用浏览器访问下面链接即可。 ---"
,
file
=
stream
)
print
(
"https://www.codecode.net/engintime/codecode/publicmanual/blob/master/GitFAQ.md"
)
print
(
Fore
.
RED
+
"https://www.codecode.net/engintime/codecode/publicmanual/blob/master/GitFAQ.md"
,
file
=
stream
)
print
(
"复制方法:右键点击本窗口的标题栏,在菜单中选择“编辑”中的“标记”后,选中要复制的内容,按回车即可"
)
print
(
Fore
.
WHITE
,
file
=
stream
)
\ No newline at end of file
test.py
浏览文件 @
15853da0
...
@@ -10,7 +10,18 @@ import filecmp
...
@@ -10,7 +10,18 @@ import filecmp
import
subprocess
import
subprocess
import
platform
import
platform
print
(
"输出安装pip包的提示信息"
)
bIncludeCi
=
False
if
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
"ci"
:
bIncludeCi
=
True
if
bIncludeCi
==
False
:
print
(
"************************************************************
\n
"
"如果下面报告类似 ImportError: No module named 'xxx' 的错误,
\n
"
"说明 python 运行环境中缺少必要的包。
\n
"
"此时可以启动
\"
安装python包
\"
任务来修复 python 运行环境(需要连接互联网)。
\n
"
"************************************************************
\n
"
)
from
colorama
import
Fore
,
init
,
AnsiToWin32
from
colorama
import
Fore
,
init
,
AnsiToWin32
init
(
wrap
=
False
)
init
(
wrap
=
False
)
...
@@ -151,25 +162,16 @@ def outputPromptInfo(bIncludeCi, promptInfo, color):
...
@@ -151,25 +162,16 @@ def outputPromptInfo(bIncludeCi, promptInfo, color):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
bIncludeCi
=
False
if
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
"ci"
:
bIncludeCi
=
True
if
bIncludeCi
==
False
:
if
bIncludeCi
==
False
:
promptInfo
=
"提示:
\n
1.如果验证程序长时间未结束,说明应用程序中可能存在死循环。请停止验证程序,修改应用程序后再验证。
\n
2.如果提示‘python’不是内部或外部命令,也不是可运行的程序或批处理文件。需要设置 Python 的环境变量并重启开发环境来解决此问题。"
print
(
"开发环境中的 Python 解释器版本号:"
+
platform
.
python_version
())
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
3
)
print
(
"开发环境中的 Python 解释器版本号:"
+
platform
.
python_version
())
print
()
print
(
"环境变量中的 Python 解释器版本号:"
,
end
=
' '
)
sys
.
stdout
.
flush
()
compResultFile
=
"result_comparation.html"
execResult
=
os
.
system
(
"python --version"
)
if
os
.
path
.
isfile
(
compResultFile
):
if
execResult
!=
0
:
os
.
remove
(
compResultFile
)
errorInfo
=
"应用程序异常,返回值:{0}。"
.
format
(
execResult
)
outputPromptInfo
(
bIncludeCi
,
errorInfo
,
2
)
exit
(
1
)
print
()
promptInfo
=
"正在使用make生成项目"
promptInfo
=
"正在使用make生成项目"
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
1
)
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
1
)
...
@@ -227,6 +229,10 @@ if __name__ == "__main__":
...
@@ -227,6 +229,10 @@ if __name__ == "__main__":
promptInfo
=
"执行的命令是: {0}"
.
format
(
runCommand
)
promptInfo
=
"执行的命令是: {0}"
.
format
(
runCommand
)
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
0
)
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
0
)
if
bIncludeCi
==
False
:
promptInfo
=
"提示:如果验证程序长时间未结束,说明应用程序中可能存在死循环。请停止验证程序(Ctrl+c),修改应用程序后再验证。"
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
3
)
execResult
=
os
.
system
(
runCommand
)
execResult
=
os
.
system
(
runCommand
)
if
execResult
!=
0
:
if
execResult
!=
0
:
errorInfo
=
"应用程序执行异常,返回值:{0}。"
.
format
(
execResult
)
errorInfo
=
"应用程序执行异常,返回值:{0}。"
.
format
(
execResult
)
...
@@ -243,7 +249,7 @@ if __name__ == "__main__":
...
@@ -243,7 +249,7 @@ if __name__ == "__main__":
# errorInfo = "输出结果比较异常,返回值:{0}。".format(execResult)
# errorInfo = "输出结果比较异常,返回值:{0}。".format(execResult)
# outputPromptInfo(bIncludeCi, errorInfo, 2)
# outputPromptInfo(bIncludeCi, errorInfo, 2)
else
:
else
:
promptInfo
=
"
提示:
\n
请使用以下方式打开文件的比较结果:
\n
选择View菜单中的Explorer菜单项,在打开的文件列表中,右击result_comparation.html文件,
\n
在弹出的菜单中选择“Open Preview”菜单项,可以打开比较结果输出文件,可帮助用户查找验证失败的原因。
"
promptInfo
=
"
查看文件比较结果可帮助你查找验证失败的原因。方法是:
\n
选择 View 菜单中的 Explorer 打开文件列表,右键点击 result_comparation.html 文件,在弹出的菜单中选择 Open Preview
"
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
2
)
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
2
)
exit
(
1
)
exit
(
1
)
seqNum
=
seqNum
+
1
seqNum
=
seqNum
+
1
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论