Skip to content

Commit

Permalink
plistlib.readPlist() is missing from Python ≥ 3.9
Browse files Browse the repository at this point in the history
This function has been deprecated since Python 3.4, replaced by `plistlib.load()`.
  • Loading branch information
DimitriPapadopoulos committed Jan 3, 2024
1 parent 0e2229d commit eac061c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,9 @@ def _macos_vers(_cache=[]):
if version == '':
plist = '/System/Library/CoreServices/SystemVersion.plist'
if os.path.exists(plist):
if hasattr(plistlib, 'readPlist'):
plist_content = plistlib.readPlist(plist)
if 'ProductVersion' in plist_content:
version = plist_content['ProductVersion']
plist_content = plistlib.load(plist)
if 'ProductVersion' in plist_content:
version = plist_content['ProductVersion']

_cache.append(version.split('.'))
return _cache[0]
Expand Down

0 comments on commit eac061c

Please sign in to comment.