Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d76cdc16
Commit
d76cdc16
authored
Nov 23, 2013
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close #19694: venv now runs ensurepip in isolated mode
parent
fd66cc55
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
Lib/test/test_venv.py
Lib/test/test_venv.py
+7
-2
Lib/venv/__init__.py
Lib/venv/__init__.py
+5
-2
No files found.
Lib/test/test_venv.py
View file @
d76cdc16
...
...
@@ -12,7 +12,7 @@ import subprocess
import
sys
import
tempfile
from
test.support
import
(
captured_stdout
,
captured_stderr
,
run_unittest
,
can_symlink
)
can_symlink
,
EnvironmentVarGuard
)
import
unittest
import
venv
...
...
@@ -280,7 +280,12 @@ class EnsurePipTest(BaseTest):
def
test_with_pip
(
self
):
shutil
.
rmtree
(
self
.
env_dir
)
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
,
with_pip
=
True
)
with
EnvironmentVarGuard
()
as
envvars
:
# pip's cross-version compatibility may trigger deprecation
# warnings in current versions of Python. Ensure related
# environment settings don't cause venv to fail.
envvars
[
"PYTHONWARNINGS"
]
=
"e"
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
,
with_pip
=
True
)
envpy
=
os
.
path
.
join
(
os
.
path
.
realpath
(
self
.
env_dir
),
self
.
bindir
,
self
.
exe
)
cmd
=
[
envpy
,
'-m'
,
'pip'
,
'--version'
]
p
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
...
...
Lib/venv/__init__.py
View file @
d76cdc16
...
...
@@ -234,8 +234,11 @@ class EnvBuilder:
def
_setup_pip
(
self
,
context
):
"""Installs or upgrades pip in a virtual environment"""
cmd
=
[
context
.
env_exe
,
'-m'
,
'ensurepip'
,
'--upgrade'
,
'--default-pip'
]
# We run ensurepip in isolated mode to avoid side effects from
# environment vars, the current directory and anything else
# intended for the global Python environment
cmd
=
[
context
.
env_exe
,
'-Im'
,
'ensurepip'
,
'--upgrade'
,
'--default-pip'
]
subprocess
.
check_output
(
cmd
)
def
setup_scripts
(
self
,
context
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment