當前位置: 首頁>>代碼示例>>Python>>正文


Python FoundationPlist.readPlistFromString方法代碼示例

本文整理匯總了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
開發者ID:Jaharmi,項目名稱:extension_attribute,代碼行數:11,代碼來源:pkgid_version.py

示例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
開發者ID:BestMacsBen,項目名稱:jaharmi-recipes,代碼行數:12,代碼來源:LaunchBar5URLProvider.py

示例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'])
開發者ID:Equiem,項目名稱:simian-1,代碼行數:33,代碼來源:flight_common.py

示例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
開發者ID:Jaharmi,項目名稱:extension_attribute,代碼行數:7,代碼來源:pkgid_version.py


注:本文中的munkilib.FoundationPlist.readPlistFromString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。