Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
筑梦之路
bypy
提交
946e2500
B
bypy
项目概览
筑梦之路
/
bypy
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
bypy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
946e2500
编写于
2月 18, 2020
作者:
H
Hou Tianze
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.6.7: Handle update check network exceptions
上级
821a46d2
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
69 addition
and
66 deletion
+69
-66
.vscode/settings.json
.vscode/settings.json
+8
-0
HISTORY.md
HISTORY.md
+1
-0
HISTORY.rst
HISTORY.rst
+2
-0
bypy/bypy.py
bypy/bypy.py
+32
-27
bypy/const.py
bypy/const.py
+1
-1
bypy/test/configdir/bypy.json
bypy/test/configdir/bypy.json
+6
-6
bypy/test/configdir/bypy.setting.json
bypy/test/configdir/bypy.setting.json
+1
-1
release.sh
release.sh
+18
-31
未找到文件。
.vscode/settings.json
0 → 100644
浏览文件 @
946e2500
{
"files.exclude"
:
{
"**/.classpath"
:
true
,
"**/.project"
:
true
,
"**/.settings"
:
true
,
"**/.factorypath"
:
true
}
}
\ No newline at end of file
HISTORY.md
浏览文件 @
946e2500
### Version History:
-
1.6.7: Handle update check network exceptions
-
1.6.6: Let it cry when dies, so we can have some trace
-
1.6.5: Fix
`KeyError: u'md5'`
in remote directory walking
-
1.6.4: Fix
`--move`
argument causing exception
...
...
HISTORY.rst
浏览文件 @
946e2500
Version History:
~~~~~~~~~~~~~~~~
- 1.6.7: Handle update check network exceptions
- 1.6.6: Let it cry when dies, so we can have some trace
- 1.6.5: Fix ``KeyError: u'md5'`` in remote directory walking
...
...
bypy/bypy.py
浏览文件 @
946e2500
...
...
@@ -478,33 +478,38 @@ class ByPy(object):
check_update
=
True
if
check_update
:
r
=
requests
.
get
(
'https://raw.githubusercontent.com/houtianze/bypy/master/update/update.json'
)
if
r
.
status_code
==
200
:
try
:
j
=
r
.
json
()
min_ver_key
=
'minimumRequiredVersion'
if
min_ver_key
in
j
:
minver
=
j
[
min_ver_key
]
if
comp_semver
(
const
.
__version__
,
minver
)
<
0
:
perr
(
"Your current version ({}) is too low, "
"minimum required version is {}.
\n
"
"Please run 'pip install -U bypy' to update and try again."
.
format
(
const
.
__version__
,
minver
))
sys
.
exit
(
const
.
EUpdateNeeded
)
else
:
self
.
__setting
[
const
.
SettingKey_LastUpdateCheckTime
]
=
nowsec
self
.
savesetting
()
recommended_ver_key
=
'recommendedVersion'
if
recommended_ver_key
in
j
:
recver
=
j
[
recommended_ver_key
]
if
comp_semver
(
const
.
__version__
,
recver
)
<
0
:
pr
(
"Your current version ({}) is low, "
"It's recommended to update to version {}.
\n
"
"Please run 'pip install -U bypy' to update."
.
format
(
const
.
__version__
,
recver
))
except
ValueError
:
self
.
pd
(
"Invalid response for update check, skipping."
)
try
:
r
=
requests
.
get
(
'https://raw.githubusercontent.com/houtianze/bypy/master/update/update.json'
)
if
r
.
status_code
==
200
:
try
:
j
=
r
.
json
()
min_ver_key
=
'minimumRequiredVersion'
if
min_ver_key
in
j
:
minver
=
j
[
min_ver_key
]
if
comp_semver
(
const
.
__version__
,
minver
)
<
0
:
perr
(
"Your current version ({}) is too low, "
"minimum required version is {}.
\n
"
"Please run 'pip install -U bypy' to update and try again."
.
format
(
const
.
__version__
,
minver
))
sys
.
exit
(
const
.
EUpdateNeeded
)
else
:
self
.
__setting
[
const
.
SettingKey_LastUpdateCheckTime
]
=
nowsec
self
.
savesetting
()
recommended_ver_key
=
'recommendedVersion'
if
recommended_ver_key
in
j
:
recver
=
j
[
recommended_ver_key
]
if
comp_semver
(
const
.
__version__
,
recver
)
<
0
:
pr
(
"Your current version ({}) is low, "
"It's recommended to update to version {}.
\n
"
"Please run 'pip install -U bypy' to update."
.
format
(
const
.
__version__
,
recver
))
except
ValueError
:
self
.
pd
(
"Invalid response for update check, skipping."
)
else
:
self
.
pd
(
"HTTP Status {} while checking update, skipping."
.
format
(
r
.
status_code
))
except
:
self
.
pd
(
"Error occurred while checking update, skipping."
)
def
pv
(
self
,
msg
,
**
kwargs
):
if
self
.
verbose
:
...
...
bypy/const.py
浏览文件 @
946e2500
...
...
@@ -12,7 +12,7 @@ import os
# https://packaging.python.org/single_source_version/
__title__
=
'bypy'
__version__
=
'1.6.
6
'
__version__
=
'1.6.
7
'
__author__
=
'Hou Tianze'
__license__
=
'MIT'
__desc__
=
'Python client for Baidu Yun (Personal Cloud Storage) 百度云/百度网盘 Python 客户端'
...
...
bypy/test/configdir/bypy.json
浏览文件 @
946e2500
{
"access_token"
:
"21.
8a8596bd8a1262ec8b53510c71a869e1.2592000.1560759917.2844184044-1572671"
,
"expires_in"
:
2592000
,
"refresh_token"
:
"22.
2b73561d88b05d31047161b3c6f2b13b.315360000.1873527917.2844184044-1572671"
,
"scope"
:
"basic netdisk"
,
"session_key"
:
"
9mnRfHOMLndTHnFeCxk30dvI/tj1klRW9XKfF9Cmd/MiY+2aZZGvkrsYLPYSa+buXmrwyBvIhlqLBFvER6l9f9CPGJYTcJVPIA=="
,
"session_secret"
:
"
cd89ab0006614803b164b69440c7457a
"
"access_token"
:
"21.
e31488969e0e452f8b1ab9685d349782.2592000.1584553337.2844184044-1572671"
,
"expires_in"
:
2592000
,
"refresh_token"
:
"22.
dc5ae4fe5d0e34af31d45f003f5fc918.315360000.1897321337.2844184044-1572671"
,
"scope"
:
"basic netdisk"
,
"session_key"
:
"
"
,
"session_secret"
:
""
}
\ No newline at end of file
bypy/test/configdir/bypy.setting.json
浏览文件 @
946e2500
{
"lastUpdateCheck"
:
15
58167911
,
"lastUpdateCheck"
:
15
81961333
,
"overwriteRemoteTempDir"
:
true
}
\ No newline at end of file
release.sh
浏览文件 @
946e2500
#!/bin/sh
# need to run the following commands before running this release script
# (This is for macOS, and for python virtualenv is recommended)
# --------
# brew install pandoc
# pip3 install pandoc pypandoc twine pyflakes
#set -o errexit
#set -x
trap
"echo '=== Release script interrupted ==='; exit -1"
SIGINT
py2venv
=
${
py2venv
-
"
$HOME
/Documents/t/pyvenv/2.7.16"
}
py3venv
=
${
py3venv
-
"
$HOME
/Documents/t/pyvenv/3.7.3"
}
pycmd
=
python
actual
=
0
build
=
0
...
...
@@ -15,18 +20,6 @@ upload=0
testit
=
0
tagit
=
0
createvenv
()
{
if
[
!
-d
"
$py2venv
"
]
then
python2
-m
virtualenv
"
$py2venv
"
fi
if
[
!
-d
"
$py3venv
"
]
then
python3
-m
virtualenv
"
$py3venv
"
fi
}
parsearg
()
{
while
getopts
"abigtu"
opt
;
do
case
"
$opt
"
in
...
...
@@ -52,14 +45,15 @@ parsearg() {
done
}
doctest
()
{
eval
$1
-m
pyflakes bypy
eval
$1
setup.py
test
#eval $1 -m doctest -v bypy.py
runtest
()
{
eval
$pycmd
-m
pyflakes bypy
eval
$pycmd
setup.py
test
#eval $pycmd -m doctest -v bypy.py
eval
$pycmd
-m
bypy
-V
eval
$pycmd
-m
bypy
--config-dir
bypy/test/configdir quota
}
installtest
()
{
.
"
$1
"
# due to requests not in testpypi
if
[
$actual
-eq
0
]
then
...
...
@@ -70,16 +64,11 @@ installtest() {
pip uninstall
-y
bypy
pip
install
-U
bypy
$indexopt
bypy
-V
bypy quota
deactivate
bypy
--config-dir
bypy/test/configdir quota
}
main
()
{
#if [ ! -f 'HISTORY.rst' ]; then
# python genrst.py
#fi
python genrst.py
createvenv
eval
$pycmd
genrst.py
parsearg
$*
if
[
"
$actual
"
-eq
0
]
...
...
@@ -103,14 +92,13 @@ main() {
if
[
"
$testit
"
-eq
1
]
then
doctest python2
doctest python3
runtest
fi
if
[
"
$build
"
-eq
1
]
then
rm
-Rf
dist/
*
python
setup.py bdist_wheel
#sdist
eval
$pycmd
setup.py bdist_wheel
#sdist
fi
uploadcmd
=
"twine upload dist/*
$repoopt
"
...
...
@@ -123,8 +111,7 @@ main() {
if
[
"
$install
"
-eq
1
]
then
installtest
"
$py2venv
/bin/activate"
installtest
"
$py3venv
/bin/activate"
installtest
fi
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录