Skip to content
GitLab
菜单
项目
群组
代码片段
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录/注册
切换导航
菜单
打开侧边栏
Wei Zhu
yobot
提交
39c48e50
提交
39c48e50
编辑于
5月 24, 2020
作者:
yuudi
浏览文件
fix: reconstruct spec file, linux executable compatibility
上级
83c098b4
变更
11
Hide whitespace changes
Inline
Side-by-side
.gitignore
浏览文件 @
39c48e50
...
...
@@ -7,6 +7,7 @@ src/client/*/
!src/client/ybplugins/
!src/client/yybplugins/
!src/client/public/
!src/client/packedfiles/
src/client/.*
src/client/*.json
!src/client/default_*
...
...
@@ -15,7 +16,6 @@ src/client/*.db
src/client/*.db-*
src/client/*.ics
src/client/*.pid
src/client/*.spec
src/client/test.py
.env
cqhttp
...
...
docs/v3/ver.json
浏览文件 @
39c48e50
{
"stable"
:
{
"version"
:
347
6
,
"url"
:
"http://img.yobot.xyz/yobot/yobot34
59
.zip"
"version"
:
347
7
,
"url"
:
"http://img.yobot.xyz/yobot/yobot34
77
.zip"
}
}
\ No newline at end of file
src/client/README.md
浏览文件 @
39c48e50
...
...
@@ -2,7 +2,23 @@
## 运行环境
python最低要求为
`python3.6`
python最低要求为
`python3.6`
## 打包
安装
`pyinstaller`
```
sh
pip
install
pyinstaller
```
打包程序
```
sh
pyinstaller main.spec
```
在
`dist`
中找到目标文件
## 扩展
...
...
src/client/logo.ico
0 → 100644
浏览文件 @
39c48e50
16.6 KB
src/client/main.py
浏览文件 @
39c48e50
...
...
@@ -15,14 +15,17 @@ loop=true
while $loop
do
loop=false
python3 main.py
-g
{}
-g
if [ -f .YOBOT_RESTART ]
then
loop=true
rm .YOBOT_RESTART
fi
done
"""
)
"""
.
format
(
'./yobot'
if
'_MEIPASS'
in
dir
(
sys
)
else
'python3 main.py'
)
)
print
(
'请通过"sh yobotg.sh"启动'
)
sys
.
exit
()
if
os
.
path
.
exists
(
'.YOBOT_RESTART'
):
...
...
src/client/main.spec
0 → 100644
浏览文件 @
39c48e50
# -*- mode: python ; coding: utf-8 -*-
import
os
import
site
sitepackages
=
site
.
getsitepackages
()
def
sitepackages_location
(
package_name
):
for
sp
in
sitepackages
:
if
os
.
path
.
exists
(
os
.
path
.
join
(
sp
,
package_name
)):
return
sp
raise
RuntimeError
(
f
"
{
package_name
}
not found"
)
block_cipher
=
None
a
=
Analysis
(
[
'main.py'
],
pathex
=
[
'.'
],
binaries
=
[],
datas
=
[
(
"packedfiles"
,
"packedfiles"
),
(
"public"
,
"public"
),
(
f
"
{
sitepackages_location
(
'opencc'
)
}
/opencc/config"
,
"opencc/config"
),
(
f
"
{
sitepackages_location
(
'opencc'
)
}
/opencc/dictionary"
,
"opencc/dictionary"
),
],
hiddenimports
=
[],
hookspath
=
[],
runtime_hooks
=
[],
excludes
=
[],
win_no_prefer_redirects
=
False
,
win_private_assemblies
=
False
,
cipher
=
block_cipher
,
noarchive
=
False
)
pyz
=
PYZ
(
a
.
pure
,
a
.
zipped_data
,
cipher
=
block_cipher
)
exe
=
EXE
(
pyz
,
a
.
scripts
,
a
.
binaries
,
a
.
zipfiles
,
a
.
datas
,
[],
name
=
'yobot'
,
debug
=
False
,
bootloader_ignore_signals
=
False
,
strip
=
False
,
upx
=
True
,
upx_exclude
=
[],
runtime_tmpdir
=
None
,
console
=
True
,
icon
=
'./logo.ico'
,
)
src/client/default_boss.json
→
src/client/
packedfiles/
default_boss.json
浏览文件 @
39c48e50
文件已移动
src/client/default_config.json
→
src/client/
packedfiles/
default_config.json
浏览文件 @
39c48e50
文件已移动
src/client/default_pool.json
→
src/client/
packedfiles/
default_pool.json
浏览文件 @
39c48e50
文件已移动
src/client/ybplugins/updater.py
浏览文件 @
39c48e50
...
...
@@ -134,6 +134,8 @@ class Updater:
sys
.
exit
()
async
def
linux_update_async
(
self
,
force
:
bool
=
False
,
test_ver
:
int
=
0
):
if
self
.
evn
==
"linux-exe"
:
return
"Linux 便携版暂时无法自动更新"
test_version
=
[
"stable"
,
"beta"
,
"alpha"
][
test_ver
]
pullcheck
=
self
.
check_commit
(
force
)
if
pullcheck
is
not
None
:
...
...
@@ -326,7 +328,7 @@ def rand_vername(seed, length=2):
def
get_version
(
base_version
:
str
,
base_commit
:
int
)
->
dict
:
if
"_MEIPASS"
in
dir
(
sys
):
return
{
"run-as"
:
"exe"
,
"run-as"
:
"exe"
if
platform
.
system
()
==
"Windows"
else
"linux-exe"
,
"ver_name"
:
"yobot{}便携版"
.
format
(
base_version
),
"ver_id"
:
3300
+
base_commit
,
"check_url"
:
[
...
...
src/client/yobot.py
浏览文件 @
39c48e50
...
...
@@ -34,7 +34,7 @@ else:
class
Yobot
:
Version
=
"[v3.6.2_beta]"
Version_id
=
17
6
Version_id
=
17
7
# "git rev-list --count HEAD"
def
__init__
(
self
,
*
,
...
...
@@ -60,7 +60,7 @@ class Yobot:
sys
.
_MEIPASS
,
"packedfiles"
,
"default_config.json"
)
else
:
default_config_f_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"default_config.json"
)
os
.
path
.
dirname
(
__file__
),
"packedfiles"
,
"default_config.json"
)
with
open
(
default_config_f_path
,
"r"
,
encoding
=
"utf-8"
)
as
config_file
:
self
.
glo_setting
=
json
.
load
(
config_file
)
if
not
os
.
path
.
exists
(
config_f_path
):
...
...
@@ -73,7 +73,7 @@ class Yobot:
sys
.
_MEIPASS
,
"packedfiles"
,
"default_boss.json"
)
else
:
default_boss_filepath
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"default_boss.json"
)
os
.
path
.
dirname
(
__file__
),
"packedfiles"
,
"default_boss.json"
)
shutil
.
copyfile
(
default_boss_filepath
,
boss_filepath
)
pool_filepath
=
os
.
path
.
join
(
dirname
,
"pool3.json"
)
if
not
os
.
path
.
exists
(
pool_filepath
):
...
...
@@ -82,7 +82,7 @@ class Yobot:
sys
.
_MEIPASS
,
"packedfiles"
,
"default_pool.json"
)
else
:
default_pool_filepath
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"default_pool.json"
)
os
.
path
.
dirname
(
__file__
),
"packedfiles"
,
"default_pool.json"
)
shutil
.
copyfile
(
default_pool_filepath
,
pool_filepath
)
with
open
(
config_f_path
,
"r+"
,
encoding
=
"utf-8"
)
as
config_file
:
cfg
=
json
.
load
(
config_file
)
...
...
编辑
预览
Supports
Markdown
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录