Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/deprecations/pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Pending removal in Python 3.15

* :mod:`platform`:

* :func:`~platform.java_ver` has been deprecated since Python 3.13.
* :func:`!platform.java_ver` has been deprecated since Python 3.13.
This function is only useful for Jython support, has a confusing API,
and is largely untested.

Expand Down
18 changes: 0 additions & 18 deletions Doc/library/platform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,24 +188,6 @@ Cross platform
:attr:`processor` is resolved late instead of immediately.


Java platform
-------------


.. function:: java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','',''))

Version interface for Jython.

Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a
tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple
``(os_name, os_version, os_arch)``. Values which cannot be determined are set to
the defaults given as parameters (which all default to ``''``).

.. deprecated-removed:: 3.13 3.15
It was largely untested, had a confusing API,
and was only useful for Jython support.


Windows platform
----------------

Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,7 @@ New Deprecations

* :mod:`platform`:

* Deprecate :func:`~platform.java_ver`,
* Deprecate :func:`!platform.java_ver`,
to be removed in Python 3.15.
This function is only useful for Jython support, has a confusing API,
and is largely untested.
Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ Deprecated
Removed
=======

platform
--------

* The deprecated :func:`!platform.java_ver` function.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The deprecated :func:`!platform.java_ver` function.
* Removed the deprecated :func:`!platform.java_ver` function.

To save Benedikt copy-editing it later. (See line 133)

You can also link this pr. (See line 134 as an example)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StanFromIreland thank you! done



sysconfig
---------

Expand Down
66 changes: 2 additions & 64 deletions Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#
# <see CVS and SVN checkin messages for history>
#
# 1.1.0 - removed deprecated java_ver()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not noteworthy enough IMO. These are rarely updated, but it is up to @malemburg in the end.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add to that list anymore. The checkin messages provide enough history.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to change # <see CVS and SVN checkin messages for history> to # <see checkin messages for history>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@malemburg thank you! done

# 1.0.9 - added invalidate_caches() function to invalidate cached values
# 1.0.8 - changed Windows support to read version from kernel32.dll
# 1.0.7 - added DEV_NULL
Expand Down Expand Up @@ -110,7 +111,7 @@

"""

__version__ = '1.0.9'
__version__ = '1.1.0'

import collections
import os
Expand Down Expand Up @@ -528,53 +529,6 @@ def ios_ver(system="", release="", model="", is_simulator=False):
return IOSVersionInfo(system, release, model, is_simulator)


def _java_getprop(name, default):
"""This private helper is deprecated in 3.13 and will be removed in 3.15"""
from java.lang import System
try:
value = System.getProperty(name)
if value is None:
return default
return value
except AttributeError:
return default

def java_ver(release='', vendor='', vminfo=('', '', ''), osinfo=('', '', '')):

""" Version interface for Jython.

Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being
a tuple (vm_name, vm_release, vm_vendor) and osinfo being a
tuple (os_name, os_version, os_arch).

Values which cannot be determined are set to the defaults
given as parameters (which all default to '').

"""
import warnings
warnings._deprecated('java_ver', remove=(3, 15))
# Import the needed APIs
try:
import java.lang # noqa: F401
except ImportError:
return release, vendor, vminfo, osinfo

vendor = _java_getprop('java.vendor', vendor)
release = _java_getprop('java.version', release)
vm_name, vm_release, vm_vendor = vminfo
vm_name = _java_getprop('java.vm.name', vm_name)
vm_vendor = _java_getprop('java.vm.vendor', vm_vendor)
vm_release = _java_getprop('java.vm.version', vm_release)
vminfo = vm_name, vm_release, vm_vendor
os_name, os_version, os_arch = osinfo
os_arch = _java_getprop('java.os.arch', os_arch)
os_name = _java_getprop('java.os.name', os_name)
os_version = _java_getprop('java.os.version', os_version)
osinfo = os_name, os_version, os_arch

return release, vendor, vminfo, osinfo


AndroidVer = collections.namedtuple(
"AndroidVer", "release api_level manufacturer model device is_emulator")

Expand Down Expand Up @@ -1034,13 +988,6 @@ def uname():
version = '16bit'
system = 'Windows'

elif system[:4] == 'java':
release, vendor, vminfo, osinfo = java_ver()
system = 'Java'
version = ', '.join(vminfo)
if not version:
version = vendor

# System specific extensions
if system == 'OpenVMS':
# OpenVMS seems to have release and version mixed up
Expand Down Expand Up @@ -1370,15 +1317,6 @@ def platform(aliased=False, terse=False):
platform = _platform(system, release, machine, processor,
'with',
libcname+libcversion)
elif system == 'Java':
# Java platforms
r, v, vminfo, (os_name, os_version, os_arch) = java_ver()
if terse or not os_name:
platform = _platform(system, release, version)
else:
platform = _platform(system, release, version,
'on',
os_name, os_version, os_arch)

else:
# Generic handler
Expand Down
9 changes: 0 additions & 9 deletions Lib/test/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,6 @@ def raises_oserror(*a):
finally:
platform._uname_cache = None

def test_java_ver(self):
import re
msg = re.escape(
"'java_ver' is deprecated and slated for removal in Python 3.15"
)
with self.assertWarnsRegex(DeprecationWarning, msg):
res = platform.java_ver()
self.assertEqual(len(res), 4)

@unittest.skipUnless(support.MS_WINDOWS, 'This test only makes sense on Windows')
def test_win32_ver(self):
release1, version1, csd1, ptype1 = 'a', 'b', 'c', 'd'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove deprecated function :func:`!platform.java_ver`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Remove deprecated function :func:`!platform.java_ver`.
Remove :func:`!platform.java_ver` which was deprecated since Python 3.13.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! fixed it

Loading