本文整理汇总了Python中munkilib.FoundationPlist.readPlistFromString方法的典型用法代码示例。如果您正苦于以下问题:Python FoundationPlist.readPlistFromString方法的具体用法?Python FoundationPlist.readPlistFromString怎么用?Python FoundationPlist.readPlistFromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类munkilib.FoundationPlist
的用法示例。
在下文中一共展示了FoundationPlist.readPlistFromString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_pkgid_version
# 需要导入模块: from munkilib import FoundationPlist [as 别名]
# 或者: from munkilib.FoundationPlist import readPlistFromString [as 别名]
def get_pkgid_version(this_pkg_plist, this_pkg_id):
if this_pkg_id in this_pkg_plist:
cmd = [pkgutil_path, "--pkg-info-plist", this_pkg_id]
cmd_output = subprocess.check_output(cmd)
cmd_output_plist = plistlib.readPlistFromString(cmd_output)
pkg_version = cmd_output_plist['pkg-version']
return pkg_version
else:
return False
示例2: get_update_feed_data
# 需要导入模块: from munkilib import FoundationPlist [as 别名]
# 或者: from munkilib.FoundationPlist import readPlistFromString [as 别名]
def get_update_feed_data(self, update_url):
"""Find the latest version of LaunchBar and output as a string."""
try:
f = urllib2.urlopen(update_url)
html = f.read()
plist_data = plistlib.readPlistFromString(html)
f.close()
except BaseException as e:
raise ProcessorError("Can't download %s: %s" % (update_url, e))
return plist_data
示例3: RepairClientError
# 需要导入模块: from munkilib import FoundationPlist [as 别名]
# 或者: from munkilib.FoundationPlist import readPlistFromString [as 别名]
updatecheck.getResourceIfChangedAtomically('%s/repair' % url, download)
except fetch.MunkiDownloadError, e:
raise RepairClientError(
'MunkiDownloadError getting Munki client: %s' % str(e))
return_code, stdout, stderr = Exec(
['/usr/bin/hdiutil', 'attach', '-mountRandom', '/tmp', '-nobrowse',
'-plist', '/tmp/munkiclient.dmg'])
if return_code != 0:
raise RepairClientError(
'Failed to attach dmg with ret %s. Error: %s' % (return_code, stderr))
# Get the mount point of the the mounted dmg; NOTE: if the munki dmg ever has
# multiple mount points then this will need adjusting.
mount_point = None
pl = fpl.readPlistFromString(stdout)
for item in pl['system-entities']:
if 'mount-point' in item:
mount_point = item['mount-point']
if not mount_point or not os.path.isdir(mount_point):
raise RepairClientError('Mount point not found:' % mount_point)
return_code, stdout, stderr = Exec(
['/usr/sbin/installer', '-pkg', '%s/munkitools.pkg' % mount_point,
'-target', '/'])
if return_code != 0:
raise RepairClientError(
'Failed to install pkg with ret %s. Error: %s' % (return_code, stderr))
unused_return_code, unused_stdout, unused_stderr = Exec(
['/usr/bin/hdiutil', 'detach', mount_point, '-force'])
示例4: list_packages_as_plist
# 需要导入模块: from munkilib import FoundationPlist [as 别名]
# 或者: from munkilib.FoundationPlist import readPlistFromString [as 别名]
def list_packages_as_plist(this_pkg_id):
cmd = [pkgutil_path, "--pkgs-plist"]
cmd_output = subprocess.check_output(cmd)
cmd_output_plist = plistlib.readPlistFromString(cmd_output)
return cmd_output_plist