Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
dafaabe8
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,发现更多精彩内容 >>
提交
dafaabe8
编写于
6月 06, 2012
作者:
P
Paul Nasrat
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #567 from qwcode/userscheme_pt3
--user fixes pt 3 Issue #493
上级
39bbf2d8
2e1959ab
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
1 deletion
+25
-1
pip/commands/install.py
pip/commands/install.py
+3
-1
pip/locations.py
pip/locations.py
+11
-0
tests/test_user_site.py
tests/test_user_site.py
+11
-0
未找到文件。
pip/commands/install.py
浏览文件 @
dafaabe8
...
...
@@ -5,7 +5,7 @@ import shutil
from
pip.req
import
InstallRequirement
,
RequirementSet
from
pip.req
import
parse_requirements
from
pip.log
import
logger
from
pip.locations
import
build_prefix
,
src_prefix
from
pip.locations
import
build_prefix
,
src_prefix
,
virtualenv_no_global
from
pip.basecommand
import
Command
from
pip.index
import
PackageFinder
from
pip.exceptions
import
InstallationError
,
CommandError
...
...
@@ -190,6 +190,8 @@ class InstallCommand(Command):
options
.
src_dir
=
os
.
path
.
abspath
(
options
.
src_dir
)
install_options
=
options
.
install_options
or
[]
if
options
.
use_user_site
:
if
virtualenv_no_global
():
raise
InstallationError
(
"Can not perform a '--user' install. User site-packages are not visible in this virtualenv."
)
install_options
.
append
(
'--user'
)
if
options
.
target_dir
:
options
.
ignore_installed
=
True
...
...
pip/locations.py
浏览文件 @
dafaabe8
"""Locations where we look for configs, install stuff, etc"""
import
sys
import
site
import
os
import
tempfile
from
pip.backwardcompat
import
get_python_lib
...
...
@@ -13,6 +14,16 @@ def running_under_virtualenv():
"""
return
hasattr
(
sys
,
'real_prefix'
)
def
virtualenv_no_global
():
"""
Return True if in a venv and no system site packages.
"""
#this mirrors the logic in virtualenv.py for locating the no-global-site-packages.txt file
site_mod_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
site
.
__file__
))
no_global_file
=
os
.
path
.
join
(
site_mod_dir
,
'no-global-site-packages.txt'
)
if
running_under_virtualenv
()
and
os
.
path
.
isfile
(
no_global_file
):
return
True
if
running_under_virtualenv
():
## FIXME: is build/ a good name?
...
...
tests/test_user_site.py
浏览文件 @
dafaabe8
...
...
@@ -83,3 +83,14 @@ class Tests_UserSite:
assert
fspkg_folder
in
result
.
files_created
,
str
(
result
.
stdout
)
assert
egg_info_folder
in
result
.
files_created
,
str
(
result
)
def
test_install_user_venv_nositepkgs_fails
(
self
):
"""
user install in virtualenv (with no system packages) fails with message
"""
env
=
reset_env
()
run_from
=
abspath
(
join
(
here
,
'packages'
,
'FSPkg'
))
result
=
run_pip
(
'install'
,
'--user'
,
curdir
,
cwd
=
run_from
,
expect_error
=
True
)
assert
"Can not perform a '--user' install. User site-packages are not visible in this virtualenv."
in
result
.
stdout
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录