launchd: remove conditional code for Python < 3.4 (#10909)

* launchd: remove conditional code for Python < 3.4

* add changelog frag
This commit is contained in:
Alexei Znamensky
2025-10-12 19:56:05 +13:00
committed by GitHub
parent 21122e926b
commit 056633efaa
2 changed files with 2 additions and 11 deletions

View File

@@ -160,9 +160,6 @@ class Plist:
state, pid, dummy, dummy = LaunchCtlList(module, self.__service).run()
# Check if readPlist is available or not
self.old_plistlib = hasattr(plistlib, 'readPlist')
self.__file = self.__find_service_plist(self.__filename)
if self.__file is None:
msg = 'Unable to find the plist file %s for service %s' % (
@@ -201,10 +198,6 @@ class Plist:
def __read_plist_file(self, module):
service_plist = {}
if self.old_plistlib:
return plistlib.readPlist(self.__file)
# readPlist is deprecated in Python 3 and onwards
try:
with open(self.__file, 'rb') as plist_fp:
service_plist = plistlib.load(plist_fp)
@@ -217,10 +210,6 @@ class Plist:
if not service_plist:
service_plist = {}
if self.old_plistlib:
plistlib.writePlist(service_plist, self.__file)
return
# writePlist is deprecated in Python 3 and onwards
try:
with open(self.__file, 'wb') as plist_fp:
plistlib.dump(service_plist, plist_fp)