Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
16528ed5
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pip
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
16528ed5
编写于
5月 17, 2018
作者:
T
Tom Freudenheim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup per PR comments
上级
cfa65e68
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
13 deletion
+5
-13
news/3905.bugfix
news/3905.bugfix
+1
-8
src/pip/_internal/utils/outdated.py
src/pip/_internal/utils/outdated.py
+2
-3
tests/unit/test_unit_outdated.py
tests/unit/test_unit_outdated.py
+2
-2
未找到文件。
news/3905.bugfix
浏览文件 @
16528ed5
Changed rules on where pip version lock file selfcheck.json is stored.
Adjust path to selfcheck.json - remove virtualenv specific path and honor cache-dir in pip.conf
Previously, the lock file was either stored at ``USER_CACHE``/selfcheck.json,
or for vitual enviorments it is stored at ``sys.prefix``\pip-selfcheck.json
Now regardless of whether the user is in a virtual environment, the lock file
is stored either in selfcheck.json in the path specified in cache-dir in
pip.conf, or if none is specified it is stored at``USER_CACHE``/selfcheck.json
src/pip/_internal/utils/outdated.py
浏览文件 @
16528ed5
...
@@ -11,7 +11,6 @@ from pip._vendor.packaging import version as packaging_version
...
@@ -11,7 +11,6 @@ from pip._vendor.packaging import version as packaging_version
from
pip._internal.compat
import
WINDOWS
from
pip._internal.compat
import
WINDOWS
from
pip._internal.index
import
PackageFinder
from
pip._internal.index
import
PackageFinder
from
pip._internal.locations
import
USER_CACHE_DIR
,
running_under_virtualenv
from
pip._internal.utils.filesystem
import
check_path_owner
from
pip._internal.utils.filesystem
import
check_path_owner
from
pip._internal.utils.misc
import
ensure_dir
,
get_installed_version
from
pip._internal.utils.misc
import
ensure_dir
,
get_installed_version
...
@@ -21,7 +20,7 @@ SELFCHECK_DATE_FMT = "%Y-%m-%dT%H:%M:%SZ"
...
@@ -21,7 +20,7 @@ SELFCHECK_DATE_FMT = "%Y-%m-%dT%H:%M:%SZ"
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
class
Global
SelfCheckState
(
object
):
class
SelfCheckState
(
object
):
def
__init__
(
self
,
cache_dir
):
def
__init__
(
self
,
cache_dir
):
self
.
statefile_path
=
os
.
path
.
join
(
cache_dir
,
"selfcheck.json"
)
self
.
statefile_path
=
os
.
path
.
join
(
cache_dir
,
"selfcheck.json"
)
...
@@ -74,7 +73,7 @@ def pip_version_check(session, options):
...
@@ -74,7 +73,7 @@ def pip_version_check(session, options):
pypi_version
=
None
pypi_version
=
None
try
:
try
:
state
=
Global
SelfCheckState
(
cache_dir
=
options
.
cache_dir
)
state
=
SelfCheckState
(
cache_dir
=
options
.
cache_dir
)
current_time
=
datetime
.
datetime
.
utcnow
()
current_time
=
datetime
.
datetime
.
utcnow
()
# Determine if we need to refresh the state
# Determine if we need to refresh the state
...
...
tests/unit/test_unit_outdated.py
浏览文件 @
16528ed5
...
@@ -74,7 +74,7 @@ def test_pip_version_check(monkeypatch, stored_time, installed_ver, new_ver,
...
@@ -74,7 +74,7 @@ def test_pip_version_check(monkeypatch, stored_time, installed_ver, new_ver,
save
=
pretend
.
call_recorder
(
lambda
v
,
t
:
None
),
save
=
pretend
.
call_recorder
(
lambda
v
,
t
:
None
),
)
)
monkeypatch
.
setattr
(
monkeypatch
.
setattr
(
outdated
,
'
Global
SelfCheckState'
,
lambda
**
kw
:
fake_state
outdated
,
'SelfCheckState'
,
lambda
**
kw
:
fake_state
)
)
with
freezegun
.
freeze_time
(
with
freezegun
.
freeze_time
(
...
@@ -137,7 +137,7 @@ def test_global_state(monkeypatch, tmpdir):
...
@@ -137,7 +137,7 @@ def test_global_state(monkeypatch, tmpdir):
monkeypatch
.
setattr
(
outdated
,
'USER_CACHE_DIR'
,
cache_dir
)
monkeypatch
.
setattr
(
outdated
,
'USER_CACHE_DIR'
,
cache_dir
)
monkeypatch
.
setattr
(
sys
,
'prefix'
,
tmpdir
/
'pip_prefix'
)
monkeypatch
.
setattr
(
sys
,
'prefix'
,
tmpdir
/
'pip_prefix'
)
state
=
outdated
.
Global
SelfCheckState
(
cache_dir
=
cache_dir
)
state
=
outdated
.
SelfCheckState
(
cache_dir
=
cache_dir
)
state
.
save
(
'2.0'
,
datetime
.
datetime
.
utcnow
())
state
.
save
(
'2.0'
,
datetime
.
datetime
.
utcnow
())
expected_path
=
cache_dir
/
'selfcheck.json'
expected_path
=
cache_dir
/
'selfcheck.json'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录