python打包工具zipapp_利用Python工具进行打包功能

基于Python脚本 iOS 工程的自动打包

导入的库

import os

import requests

import webbrowser

import subprocess

import shutil

appFileFullPath = 'XXX.app'# .app的绝对路径(iOS工程的绝对路径)

PayLoadPath = '***' payload的路径

packBagPath = '/Users/zrq/Desktop/IPAPath'//ipa包的绝对路径

#编译打包流程

def bulidIPA():

#删除之前打包的ProgramBag文件夹

subprocess.call(["rm","-rf",packBagPath])

#创建PayLoad文件夹

mkdir(PayLoadPath)

#将app拷贝到PayLoadPath路径下

subprocess.call(["cp","-r",appFileFullPath,PayLoadPath])

#在桌面上创建packBagPath的文件夹

subprocess.call(["mkdir","-p",packBagPath])

#将PayLoadPath文件夹拷贝到packBagPath文件夹下

subprocess.call(["cp","-r",PayLoadPath,packBagPath])

#删除桌面的PayLoadPath文件夹

subprocess.call(["rm","-rf",PayLoadPath])

#切换到当前目录

os.chdir(packBagPath)

#压缩packBagPath文件夹下的PayLoadPath文件夹夹

subprocess.call(["zip","-r","./Payload.zip","."])

print ("\n*************** 打包成功 *********************\n")

#将zip文件改名为ipa

subprocess.call(["mv","payload.zip","Payload.ipa"])

#删除payLoad文件夹

subprocess.call(["rm","-rf","./Payload"])

#创建PayLoad文件夹

def mkdir(PayLoadPath):

isExists = os.path.exists(PayLoadPath)

if not isExists:

os.makedirs(PayLoadPath)

print(PayLoadPath + '创建成功')

return True

else:

print (PayLoadPath + '目录已经存在')

return False

if __name__ == '__main__':

bulidIPA()

uploadIPA('%s/Payload.ipa'%packBagPath)

//主动调用打包

原博客地址:http://www.cocoachina.com/ios/20180507/23295.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值