在python中等效的Xcode构建命令

时间:2015-04-16 08:22:40

标签: python python-3.4 xcrun

我尝试了相当于:

/usr/bin/xcrun -sdk iphoneos PackageApplication -v  "$APP_OUTPUT_DIR"/"$PRODUCT_NAME".app -o "$APP_OUTPUT_DIR"/"$PLIST_IPA_NAME".ipa -embed "$PROVISONING_PROFILE_PATH" "OTHER_CODE_SIGN_FLAGS=--keychain $TEAMCITY_RUN_SCRIPT_LOCATION/$TEAMCITY_KEYCHAIN"

在python3.4中使用子进程:

value = '/usr/bin/xcrun'
cmd = [value1]
cmd += [" -sdk iphoneos PackageApplication -v " + app_output_directory + '/' + product_name + '.app']
cmd += [" -o " + app_output_directory + '/' + product_name + '.ipa']
cmd += [" -embed " + provisioning_profile_path]
cmd += [' --keychain ' + value]
print(cmd)
subprocess.call(cmd)

我做得对吗?如果没有,请提供解决方案。

编辑:错误就像

xcrun: error: unable to find utility "\ -sdk\ iphoneos\ PackageApplication\ -v\ /Users/NAME/Desktop/iOS/build/Sun\ Risers.app", not a developer tool or in PATH

1 个答案:

答案 0 :(得分:1)

您应该将每个命令行参数作为不同的列表项传递,如:

value = '/usr/bin/xcrun'
cmd = [value]
cmd.append('-sdk iphoneos PackageApplication')
cmd.append('-v' + app_output_directory + '/' + product_name + '.app')
...
subprocess.call(cmd)