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
2f3742b0
Kaydet (Commit)
2f3742b0
authored
May 13, 2015
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #1322: platform.dist() and platform.linux_distribution() functions are now deprecated.
Initial patch by Vajrasky Kok.
üst
de7cafaa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
8 deletions
+47
-8
platform.rst
Doc/library/platform.rst
+4
-0
3.5.rst
Doc/whatsnew/3.5.rst
+5
-0
platform.py
Lib/platform.py
+16
-3
test_platform.py
Lib/test/test_platform.py
+19
-5
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/platform.rst
Dosyayı görüntüle @
2f3742b0
...
@@ -247,6 +247,8 @@ Unix Platforms
...
@@ -247,6 +247,8 @@ Unix Platforms
This is another name for :func:`linux_distribution`.
This is another name for :func:`linux_distribution`.
.. deprecated-removed:: 3.5 3.7
.. function:: linux_distribution(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...), full_distribution_name=1)
.. function:: linux_distribution(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...), full_distribution_name=1)
Tries to determine the name of the Linux OS distribution name.
Tries to determine the name of the Linux OS distribution name.
...
@@ -263,6 +265,8 @@ Unix Platforms
...
@@ -263,6 +265,8 @@ Unix Platforms
parameters. ``id`` is the item in parentheses after the version number. It
parameters. ``id`` is the item in parentheses after the version number. It
is usually the version codename.
is usually the version codename.
.. deprecated-removed:: 3.5 3.7
.. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=2048)
.. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=2048)
Tries to determine the libc version against which the file executable (defaults
Tries to determine the libc version against which the file executable (defaults
...
...
Doc/whatsnew/3.5.rst
Dosyayı görüntüle @
2f3742b0
...
@@ -700,6 +700,11 @@ Deprecated Python modules, functions and methods
...
@@ -700,6 +700,11 @@ Deprecated Python modules, functions and methods
:meth:`~string.Formatter.format` method of the :class:`string.Formatter`
:meth:`~string.Formatter.format` method of the :class:`string.Formatter`
class has been deprecated.
class has been deprecated.
* :func:`platform.dist` and :func:`platform.linux_distribution` functions are
now deprecated and will be removed in Python 3.7. Linux distributions use
too many different ways of describing themselves, so the functionality is
left to a package.
(Contributed by Vajrasky Kok and Berker Peksag in :issue:`1322`.)
Deprecated functions and types of the C API
Deprecated functions and types of the C API
-------------------------------------------
-------------------------------------------
...
...
Lib/platform.py
Dosyayı görüntüle @
2f3742b0
...
@@ -297,6 +297,15 @@ def linux_distribution(distname='', version='', id='',
...
@@ -297,6 +297,15 @@ def linux_distribution(distname='', version='', id='',
supported_dists
=
_supported_dists
,
supported_dists
=
_supported_dists
,
full_distribution_name
=
1
):
full_distribution_name
=
1
):
import
warnings
warnings
.
warn
(
"dist() and linux_distribution() functions are deprecated "
"in Python 3.5 and will be removed in Python 3.7"
,
PendingDeprecationWarning
,
stacklevel
=
2
)
return
_linux_distribution
(
distname
,
version
,
id
,
supported_dists
,
full_distribution_name
)
def
_linux_distribution
(
distname
,
version
,
id
,
supported_dists
,
full_distribution_name
):
""" Tries to determine the name of the Linux OS distribution name.
""" Tries to determine the name of the Linux OS distribution name.
...
@@ -363,9 +372,13 @@ def dist(distname='', version='', id='',
...
@@ -363,9 +372,13 @@ def dist(distname='', version='', id='',
args given as parameters.
args given as parameters.
"""
"""
return
linux_distribution
(
distname
,
version
,
id
,
import
warnings
supported_dists
=
supported_dists
,
warnings
.
warn
(
"dist() and linux_distribution() functions are deprecated "
full_distribution_name
=
0
)
"in Python 3.5 and will be removed in Python 3.7"
,
PendingDeprecationWarning
,
stacklevel
=
2
)
return
_linux_distribution
(
distname
,
version
,
id
,
supported_dists
=
supported_dists
,
full_distribution_name
=
0
)
def
popen
(
cmd
,
mode
=
'r'
,
bufsize
=-
1
):
def
popen
(
cmd
,
mode
=
'r'
,
bufsize
=-
1
):
...
...
Lib/test/test_platform.py
Dosyayı görüntüle @
2f3742b0
...
@@ -311,10 +311,24 @@ class PlatformTest(unittest.TestCase):
...
@@ -311,10 +311,24 @@ class PlatformTest(unittest.TestCase):
self
.
assertEqual
(
version
,
'19'
)
self
.
assertEqual
(
version
,
'19'
)
self
.
assertEqual
(
distid
,
'Schr
\xf6
dinger
\u2019
s Cat'
)
self
.
assertEqual
(
distid
,
'Schr
\xf6
dinger
\u2019
s Cat'
)
def
test_main
():
support
.
run_unittest
(
class
DeprecationTest
(
unittest
.
TestCase
):
PlatformTest
)
def
test_dist_deprecation
(
self
):
with
self
.
assertWarns
(
PendingDeprecationWarning
)
as
cm
:
platform
.
dist
()
self
.
assertEqual
(
str
(
cm
.
warning
),
'dist() and linux_distribution() functions are '
'deprecated in Python 3.5 and will be removed in '
'Python 3.7'
)
def
test_linux_distribution_deprecation
(
self
):
with
self
.
assertWarns
(
PendingDeprecationWarning
)
as
cm
:
platform
.
linux_distribution
()
self
.
assertEqual
(
str
(
cm
.
warning
),
'dist() and linux_distribution() functions are '
'deprecated in Python 3.5 and will be removed in '
'Python 3.7'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_
main
()
unittest
.
main
()
Misc/NEWS
Dosyayı görüntüle @
2f3742b0
...
@@ -45,6 +45,9 @@ Core and Builtins
...
@@ -45,6 +45,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #1322: platform.dist() and platform.linux_distribution() functions are
now deprecated. Initial patch by Vajrasky Kok.
- Issue #22486: Added the math.gcd() function. The fractions.gcd() function now is
- Issue #22486: Added the math.gcd() function. The fractions.gcd() function now is
deprecated. Based on patch by Mark Dickinson.
deprecated. Based on patch by Mark Dickinson.
...
...
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