Xcode 在 python 中等效的构建命令

Xcode build command equivalent in python

我试过相当于:

/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

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

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