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


Python NSMutableDictionary.dictionaryWithContentsOfFile_方法代碼示例

本文整理匯總了Python中Foundation.NSMutableDictionary.dictionaryWithContentsOfFile_方法的典型用法代碼示例。如果您正苦於以下問題:Python NSMutableDictionary.dictionaryWithContentsOfFile_方法的具體用法?Python NSMutableDictionary.dictionaryWithContentsOfFile_怎麽用?Python NSMutableDictionary.dictionaryWithContentsOfFile_使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Foundation.NSMutableDictionary的用法示例。


在下文中一共展示了NSMutableDictionary.dictionaryWithContentsOfFile_方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: change_bundle_id

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
def change_bundle_id(filename, new_bundle_id):
	
    keyToModify = 'CFBundleIdentifier'
    plist = NSMutableDictionary.dictionaryWithContentsOfFile_(filename)
    if plist != None and keyToModify in plist.allKeys():
        plist[keyToModify] = new_bundle_id
        plist.writeToFile_atomically_(filename, 1)
開發者ID:akfreas,項目名稱:ios-ci-tools,代碼行數:9,代碼來源:PlistUtility.py

示例2: get_version

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
 def get_version(self, dry=False):
     info = Folder(self.app.path).child('Contents/Info.plist')
     if not File(info).exists:
         self.fail("InfoPlist not found at :" + info)
     from Foundation import NSMutableDictionary
     plist = NSMutableDictionary.dictionaryWithContentsOfFile_(info)
     self.app.build_version = plist['CFBundleVersion']
     self.app.marketing_version = plist.get('CFBundleShortVersionString', self.app.build_version)
開發者ID:lakshmivyas,項目名稱:conche,代碼行數:10,代碼來源:providers.py

示例3: increment_release_version

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
def increment_release_version(filename, version):

    keyToModify = 'CFBundleVersion'
    plist = NSMutableDictionary.dictionaryWithContentsOfFile_(filename)
    if keyToModify in plist.allKeys():
        versionString = plist[keyToModify]
        versionList = versionString.split(".")
        versionList.append(version)
        versionString = ".".join(versionList)
        plist[keyToModify] = versionString
        plist.writeToFile_atomically_(filename, 1)
        return versionString
開發者ID:akfreas,項目名稱:ios-ci-tools,代碼行數:14,代碼來源:PlistUtility.py

示例4: increment_development_version

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
def increment_development_version(filename, version):

    keyToModify = 'CFBundleShortVersionString'
    plist = NSMutableDictionary.dictionaryWithContentsOfFile_(filename)
    if keyToModify in plist.allKeys():
        versionString = plist[keyToModify]
        versionList = versionString.split(".")
        lastVersionNumber = int(versionList[-1])
        versionList.append(version)
        versionString = ".".join(versionList)
        plist[keyToModify] = versionString
        plist.writeToFile_atomically_(filename, 1)
        return versionString
開發者ID:akfreas,項目名稱:ios-ci-tools,代碼行數:15,代碼來源:PlistUtility.py

示例5: change_provisioning_profile

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
def change_provisioning_profile(filename, build_conf_name, provisioning_profile):

    pbx_dict = NSMutableDictionary.dictionaryWithContentsOfFile_(filename)
    configurations = [x for x in pbx_dict['objects'] if pbx_dict['objects'][x]['isa'] == "XCBuildConfiguration" and pbx_dict['objects'][x]['name'] == "Release" and "PROVISIONING_PROFILE" in pbx_dict['objects'][x]['buildSettings'].allKeys()]    

    profiles_to_replace = []

    for config in configurations:
        profiles_to_replace.append(pbx_dict['objects'][config]['buildSettings']['PROVISIONING_PROFILE'])
        profiles_to_replace.append(pbx_dict['objects'][config]['buildSettings']['PROVISIONING_PROFILE[sdk=iphoneos*]'])

    for profile in profiles_to_replace:
        print "%s was replaced with %s in %s" % (profile, provisioning_profile, filename)
        replace(filename, profile, provisioning_profile)
開發者ID:akfreas,項目名稱:ios-ci-tools,代碼行數:16,代碼來源:PlistUtility.py

示例6: SetPlistKey

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
def SetPlistKey(plist, key, value):
  """Sets the value for a given key in a plist.

  Args:
    plist: plist to operate on
    key: key to change
    value: value to set
  Returns:
    boolean: success
  Raises:
    MissingImportsError: if NSMutableDictionary is missing
  """
  if NSMutableDictionary:
    mach_info = NSMutableDictionary.dictionaryWithContentsOfFile_(plist)
    if not mach_info:
      mach_info = NSMutableDictionary.alloc().init()
    mach_info[key] = value
    return mach_info.writeToFile_atomically_(plist, True)
  else:
    raise MissingImportsError('NSMutableDictionary not imported successfully.')
開發者ID:SmithersJr,項目名稱:macops,代碼行數:22,代碼來源:gmacpyutil.py

示例7: ModifyPlist

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
def ModifyPlist( target_inf ):
    vardict = target_inf['vars']
    filePath = vardict['xcodeplist_path']
    print "\nModifying " + filePath

    plist = NSMutableDictionary.dictionaryWithContentsOfFile_( filePath )

    plist['CFBundleDisplayName'] = vardict['name']
    plist['CFBundleIdentifier'] = vardict['id']
    plist['CFBundleVersion'] = vardict['version']
    plist['CFBundleShortVersionString'] = vardict['major_version']

    plist['UIViewControllerBasedStatusBarAppearance'] = False

    batch_config.ModifyPlist( plist, vardict['build_mode'] )

    # save plist file
    plist.writeToFile_atomically_( filePath, 1 )

    #print "-----------------------------------------------------------------"
    #os.system("cat " + filePath)
    #print "-----------------------------------------------------------------"

    return
開發者ID:UnicGames,項目名稱:UnityBatchBuild,代碼行數:26,代碼來源:batch.py

示例8: len

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
        pass
from Foundation import NSMutableDictionary

if os.environ["CONFIGURATION"] == "Development":
        status, output = commands.getstatusoutput("bash -l -c 'LANGUAGE=C svn info'")
        if status != 0:
                sys.exit(status)

        for line in output.split("\n"):
                if len(line.strip()) == 0 or ":" not in line:
                        continue
                key, value = [x.lower().strip() for x in line.split(":", 1)]
                if key == "revision":
                        revision = "svn" + value
                        break
else:
        revision = time.strftime("%Y%m%d")

revision="1.0.0.20110909"
buildDir = os.environ["BUILT_PRODUCTS_DIR"]
infoFile = os.environ["INFOPLIST_PATH"]
path = os.path.join(buildDir, infoFile)
plist = NSMutableDictionary.dictionaryWithContentsOfFile_(path)
version = open("version.txt").read().strip() % {"extra": revision}
print "Updating versions:", infoFile, version
plist["CFBundleShortVersionString"] = version
plist["CFBundleGetInfoString"] = version
plist["CFBundleVersion"] = version
plist.writeToFile_atomically_(path, 1)

開發者ID:step2zero,項目名稱:iTerm2,代碼行數:31,代碼來源:updateVersion.py

示例9: in

# 需要導入模塊: from Foundation import NSMutableDictionary [as 別名]
# 或者: from Foundation.NSMutableDictionary import dictionaryWithContentsOfFile_ [as 別名]
    elif opt in ("-t", "--plist-app-title"): 
        PLIST_APP_TITLE = arg            
    elif opt in ("-s", "--plist-app-subtitle"): 
        PLIST_APP_SUBTITLE = arg                
    elif opt in ("-n", "--plist-name"): 
        PLIST_NAME = arg        
    elif opt in ("-i", "--bundle-ident-suffix"):
        PLIST_BUNDLE_IDENTIFIER_SUFFIX = arg
            

from Foundation import NSMutableDictionary
from Foundation import NSMutableArray
if not PLIST_APPLICATION_INFO_LOCATION:
   print '[ERROR] Cannot find plist file %(PLIST_APPLICATION_INFO_LOCATION)'
   sys.exit(1)
application_info = NSMutableDictionary.dictionaryWithContentsOfFile_(PLIST_APPLICATION_INFO_LOCATION)
PLIST_BUNDLE_IDENTIFIER = application_info.objectForKey_('CFBundleIdentifier')
if PLIST_BUNDLE_IDENTIFIER_SUFFIX != '':
   PLIST_BUNDLE_IDENTIFIER = PLIST_BUNDLE_IDENTIFIER + PLIST_BUNDLE_IDENTIFIER_SUFFIX
PLIST_BUNDLE_VERSION = application_info.objectForKey_('CFBundleVersion')
print '[DEBUG] Bundle identifier = %(PLIST_BUNDLE_IDENTIFIER)s' % vars()
print '[DEBUG] Bundle version    = %(PLIST_BUNDLE_VERSION)s' % vars()


root = NSMutableDictionary.dictionary()
items = NSMutableArray.array()
root.setObject_forKey_(items,'items')
main_item = NSMutableDictionary.dictionary()
items.addObject_(main_item)

assets = NSMutableArray.array()
開發者ID:programming086,項目名稱:cintegration,代碼行數:33,代碼來源:plist-creator.py


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