Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
db6322cb
Kaydet (Commit)
db6322cb
authored
Şub 02, 2017
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixes #24875: pip can now be installed in a venv with --system-site-packages.
üst
a5917d1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
+25
-9
test_venv.py
Lib/test/test_venv.py
+16
-9
__init__.py
Lib/venv/__init__.py
+9
-0
No files found.
Lib/test/test_venv.py
Dosyayı görüntüle @
db6322cb
...
...
@@ -328,13 +328,7 @@ class EnsurePipTest(BaseTest):
with
open
(
os
.
devnull
,
"rb"
)
as
f
:
self
.
assertEqual
(
f
.
read
(),
b
""
)
# Requesting pip fails without SSL (http://bugs.python.org/issue19744)
@unittest.skipIf
(
ssl
is
None
,
ensurepip
.
_MISSING_SSL_MESSAGE
)
@unittest.skipUnless
(
threading
,
'some dependencies of pip import threading'
' module unconditionally'
)
# Issue #26610: pip/pep425tags.py requires ctypes
@unittest.skipUnless
(
ctypes
,
'pip requires ctypes'
)
def
test_with_pip
(
self
):
def
do_test_with_pip
(
self
,
system_site_packages
):
rmtree
(
self
.
env_dir
)
with
EnvironmentVarGuard
()
as
envvars
:
# pip's cross-version compatibility may trigger deprecation
...
...
@@ -368,6 +362,7 @@ class EnsurePipTest(BaseTest):
# config in place to ensure we ignore it
try
:
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
,
system_site_packages
=
system_site_packages
,
with_pip
=
True
)
except
subprocess
.
CalledProcessError
as
exc
:
# The output this produces can be a little hard to read,
...
...
@@ -417,9 +412,21 @@ class EnsurePipTest(BaseTest):
out
=
out
.
decode
(
"latin-1"
)
# Force to text, prevent decoding errors
self
.
assertIn
(
"Successfully uninstalled pip"
,
out
)
self
.
assertIn
(
"Successfully uninstalled setuptools"
,
out
)
# Check pip is now gone from the virtual environment
self
.
assert_pip_not_installed
()
# Check pip is now gone from the virtual environment. This only
# applies in the system_site_packages=False case, because in the
# other case, pip may still be available in the system site-packages
if
not
system_site_packages
:
self
.
assert_pip_not_installed
()
# Requesting pip fails without SSL (http://bugs.python.org/issue19744)
@unittest.skipIf
(
ssl
is
None
,
ensurepip
.
_MISSING_SSL_MESSAGE
)
@unittest.skipUnless
(
threading
,
'some dependencies of pip import threading'
' module unconditionally'
)
# Issue #26610: pip/pep425tags.py requires ctypes
@unittest.skipUnless
(
ctypes
,
'pip requires ctypes'
)
def
test_with_pip
(
self
):
self
.
do_test_with_pip
(
False
)
self
.
do_test_with_pip
(
True
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Lib/venv/__init__.py
Dosyayı görüntüle @
db6322cb
...
...
@@ -77,6 +77,10 @@ class EnvBuilder:
"""
env_dir
=
os
.
path
.
abspath
(
env_dir
)
context
=
self
.
ensure_directories
(
env_dir
)
# See issue 24875. We need system_site_packages to be False
# until after pip is installed.
true_system_site_packages
=
self
.
system_site_packages
self
.
system_site_packages
=
False
self
.
create_configuration
(
context
)
self
.
setup_python
(
context
)
if
self
.
with_pip
:
...
...
@@ -84,6 +88,11 @@ class EnvBuilder:
if
not
self
.
upgrade
:
self
.
setup_scripts
(
context
)
self
.
post_setup
(
context
)
if
true_system_site_packages
:
# We had set it to False before, now
# restore it and rewrite the configuration
self
.
system_site_packages
=
True
self
.
create_configuration
(
context
)
def
clear_directory
(
self
,
path
):
for
fn
in
os
.
listdir
(
path
):
...
...
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