Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
5fcd4bfa
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
11 个月 前同步成功
通知
1767
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
5fcd4bfa
编写于
3月 27, 2023
作者:
A
AUTOMATIC
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
do not read extensions' git stuff at startup
上级
5cf3822e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
10 deletion
+24
-10
modules/extensions.py
modules/extensions.py
+19
-10
modules/ui_extensions.py
modules/ui_extensions.py
+5
-0
未找到文件。
modules/extensions.py
浏览文件 @
5fcd4bfa
...
...
@@ -5,13 +5,14 @@ import traceback
import
time
import
git
from
modules
import
paths
,
shared
from
modules
import
shared
from
modules.paths_internal
import
extensions_dir
,
extensions_builtin_dir
extensions
=
[]
if
not
os
.
path
.
exists
(
paths
.
extensions_dir
):
os
.
makedirs
(
paths
.
extensions_dir
)
if
not
os
.
path
.
exists
(
extensions_dir
):
os
.
makedirs
(
extensions_dir
)
def
active
():
return
[
x
for
x
in
extensions
if
x
.
enabled
]
...
...
@@ -26,21 +27,29 @@ class Extension:
self
.
can_update
=
False
self
.
is_builtin
=
is_builtin
self
.
version
=
''
self
.
remote
=
None
self
.
have_info_from_repo
=
False
def
read_info_from_repo
(
self
):
if
self
.
have_info_from_repo
:
return
self
.
have_info_from_repo
=
True
repo
=
None
try
:
if
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
".git"
)):
repo
=
git
.
Repo
(
path
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
path
,
".git"
)):
repo
=
git
.
Repo
(
self
.
path
)
except
Exception
:
print
(
f
"Error reading github repository info from
{
path
}
:"
,
file
=
sys
.
stderr
)
print
(
f
"Error reading github repository info from
{
self
.
path
}
:"
,
file
=
sys
.
stderr
)
print
(
traceback
.
format_exc
(),
file
=
sys
.
stderr
)
if
repo
is
None
or
repo
.
bare
:
self
.
remote
=
None
else
:
try
:
self
.
remote
=
next
(
repo
.
remote
().
urls
,
None
)
self
.
status
=
'unknown'
self
.
remote
=
next
(
repo
.
remote
().
urls
,
None
)
head
=
repo
.
head
.
commit
ts
=
time
.
asctime
(
time
.
gmtime
(
repo
.
head
.
commit
.
committed_date
))
self
.
version
=
f
'
{
head
.
hexsha
[:
8
]
}
(
{
ts
}
)'
...
...
@@ -85,11 +94,11 @@ class Extension:
def
list_extensions
():
extensions
.
clear
()
if
not
os
.
path
.
isdir
(
paths
.
extensions_dir
):
if
not
os
.
path
.
isdir
(
extensions_dir
):
return
extension_paths
=
[]
for
dirname
in
[
paths
.
extensions_dir
,
paths
.
extensions_builtin_dir
]:
for
dirname
in
[
extensions_dir
,
extensions_builtin_dir
]:
if
not
os
.
path
.
isdir
(
dirname
):
return
...
...
@@ -98,7 +107,7 @@ def list_extensions():
if
not
os
.
path
.
isdir
(
path
):
continue
extension_paths
.
append
((
extension_dirname
,
path
,
dirname
==
paths
.
extensions_builtin_dir
))
extension_paths
.
append
((
extension_dirname
,
path
,
dirname
==
extensions_builtin_dir
))
for
dirname
,
path
,
is_builtin
in
extension_paths
:
extension
=
Extension
(
name
=
dirname
,
path
=
path
,
enabled
=
dirname
not
in
shared
.
opts
.
disabled_extensions
,
is_builtin
=
is_builtin
)
...
...
modules/ui_extensions.py
浏览文件 @
5fcd4bfa
...
...
@@ -63,6 +63,9 @@ def check_updates(id_task, disable_list):
try
:
ext
.
check_updates
()
except
FileNotFoundError
as
e
:
if
'FETCH_HEAD'
not
in
str
(
e
):
raise
except
Exception
:
print
(
f
"Error checking updates for
{
ext
.
name
}
:"
,
file
=
sys
.
stderr
)
print
(
traceback
.
format_exc
(),
file
=
sys
.
stderr
)
...
...
@@ -87,6 +90,8 @@ def extension_table():
"""
for
ext
in
extensions
.
extensions
:
ext
.
read_info_from_repo
()
remote
=
f
"""<a href="
{
html
.
escape
(
ext
.
remote
or
''
)
}
" target="_blank">
{
html
.
escape
(
"built-in"
if
ext
.
is_builtin
else
ext
.
remote
or
''
)
}
</a>"""
if
ext
.
can_update
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录