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 authored and abravalheri committed Jan 5, 2024
1 parent 25c1b27 commit b393570
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,10 @@ 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']
with open(plist, 'rb') as fh:
plist_content = plistlib.load(fh)
if 'ProductVersion' in plist_content:
version = plist_content['ProductVersion']

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

0 comments on commit b393570

Please sign in to comment.