本文整理汇总了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)
示例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)
示例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
示例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
示例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)
示例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.')
示例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
示例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)
示例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()