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
fa6cfbc4
Kaydet (Commit)
fa6cfbc4
authored
Haz 10, 2011
tarafından
Éric Araujo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Don’t try to install something when running from uninstalled source (#12246).
Original patch by Tshepang Lekhonkhobe.
üst
2b612220
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
5 deletions
+31
-5
install.py
Lib/packaging/install.py
+14
-3
test_install.py
Lib/packaging/tests/test_install.py
+12
-2
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/packaging/install.py
Dosyayı görüntüle @
fa6cfbc4
...
@@ -13,7 +13,7 @@ import errno
...
@@ -13,7 +13,7 @@ import errno
import
shutil
import
shutil
import
logging
import
logging
import
tempfile
import
tempfile
from
sysconfig
import
get_config_var
,
get_path
from
sysconfig
import
get_config_var
,
get_path
,
is_python_build
from
packaging
import
logger
from
packaging
import
logger
from
packaging.dist
import
Distribution
from
packaging.dist
import
Distribution
...
@@ -488,20 +488,31 @@ def install(project):
...
@@ -488,20 +488,31 @@ def install(project):
Returns True on success, False on failure
Returns True on success, False on failure
"""
"""
if
is_python_build
():
# Python would try to install into the site-packages directory under
# $PREFIX, but when running from an uninstalled code checkout we don't
# want to create directories under the installation root
message
=
(
'installing third-party projects from an uninstalled '
'Python is not supported'
)
logger
.
error
(
message
)
return
False
logger
.
info
(
'Checking the installation location...'
)
logger
.
info
(
'Checking the installation location...'
)
purelib_path
=
get_path
(
'purelib'
)
purelib_path
=
get_path
(
'purelib'
)
# trying to write a file there
# trying to write a file there
try
:
try
:
with
tempfile
.
NamedTemporaryFile
(
suffix
=
project
,
with
tempfile
.
NamedTemporaryFile
(
suffix
=
project
,
dir
=
purelib_path
)
as
testfile
:
dir
=
purelib_path
)
as
testfile
:
testfile
.
write
(
b
'test'
)
testfile
.
write
(
b
'test'
)
except
OSError
:
except
OSError
:
# was unable to write a file
# FIXME this should check the errno, or be removed altogether (race
# condition: the directory permissions could be changed between here
# and the actual install)
logger
.
info
(
'Unable to write in "
%
s". Do you have the permissions ?'
logger
.
info
(
'Unable to write in "
%
s". Do you have the permissions ?'
%
purelib_path
)
%
purelib_path
)
return
False
return
False
logger
.
info
(
'Getting information about
%
r...'
,
project
)
logger
.
info
(
'Getting information about
%
r...'
,
project
)
try
:
try
:
info
=
get_infos
(
project
)
info
=
get_infos
(
project
)
...
...
Lib/packaging/tests/test_install.py
Dosyayı görüntüle @
fa6cfbc4
"""Tests for the packaging.install module."""
"""Tests for the packaging.install module."""
import
os
import
os
import
logging
from
sysconfig
import
is_python_build
from
tempfile
import
mkstemp
from
tempfile
import
mkstemp
from
packaging
import
install
from
packaging
import
install
...
@@ -357,9 +359,17 @@ class TestInstall(LoggingCatcher, TempdirManager, unittest.TestCase):
...
@@ -357,9 +359,17 @@ class TestInstall(LoggingCatcher, TempdirManager, unittest.TestCase):
install
.
_install_dist
=
old_install_dist
install
.
_install_dist
=
old_install_dist
def
test_install_permission_denied
(
self
):
def
test_install_permission_denied
(
self
):
# if we don't have
the access to the installation
# if we don't have
access to the installation path, we should abort
#
path, we should abort immediat
ly
#
immediate
ly
project
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'package.tgz'
)
project
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'package.tgz'
)
# when running from an uninstalled build, a warning is emitted and the
# installation is not attempted
if
is_python_build
():
self
.
assertFalse
(
install
.
install
(
project
))
self
.
assertEqual
(
1
,
len
(
self
.
get_logs
(
logging
.
ERROR
)))
return
install_path
=
self
.
mkdtemp
()
install_path
=
self
.
mkdtemp
()
old_get_path
=
install
.
get_path
old_get_path
=
install
.
get_path
install
.
get_path
=
lambda
path
:
install_path
install
.
get_path
=
lambda
path
:
install_path
...
...
Misc/ACKS
Dosyayı görüntüle @
fa6cfbc4
...
@@ -550,6 +550,7 @@ Joerg Lehmann
...
@@ -550,6 +550,7 @@ Joerg Lehmann
Robert Lehmann
Robert Lehmann
Petri Lehtinen
Petri Lehtinen
Luke Kenneth Casson Leighton
Luke Kenneth Casson Leighton
Tshepang Lekhonkhobe
Marc-Andre Lemburg
Marc-Andre Lemburg
John Lenton
John Lenton
Christopher Tur Lesniewski-Laas
Christopher Tur Lesniewski-Laas
...
...
Misc/NEWS
Dosyayı görüntüle @
fa6cfbc4
...
@@ -187,6 +187,10 @@ Core and Builtins
...
@@ -187,6 +187,10 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12246: Warn and fail when trying to install a third-party project from
an uninstalled Python (built in a source checkout). Original patch by
Tshepang Lekhonkhobe.
- Issue #11583: Speed up os.path.isdir on Windows by using GetFileAttributes
- Issue #11583: Speed up os.path.isdir on Windows by using GetFileAttributes
instead of os.stat.
instead of os.stat.
...
...
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