Created
December 1, 2017 06:24
-
-
Save anonymous/7f3f4c10a01a5694ff8bb4dd94341c0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
# @Filename : Client.py | |
# @Date : 17-5-5 下午8:30 | |
# @Author : DebuggerX | |
import os | |
import xmlrpclib | |
import zipfile | |
def adddir2zip(zfile, *dirs): | |
for d in dirs: | |
for dpath, dnames, fnames in os.walk(d): | |
for fname in fnames: | |
zfile.write(os.path.join(dpath, fname)) | |
def addfile2zip(zfile, *files): | |
for f in files: | |
zfile.write(os.path.join(f)) | |
# 创建用于上传的upload.zip | |
z = zipfile.ZipFile('upload.zip', 'w', zipfile.ZIP_DEFLATED) | |
# 添加src目录&libs目录及所有文件,添加工程配置文件 | |
adddir2zip(z, "src", "libs") | |
addfile2zip(z, ".actionScriptProperties") | |
z.close() | |
proxy = xmlrpclib.ServerProxy("http://10.0.0.1:39999/", allow_none=True) | |
with open("upload.zip", 'rb') as updatefile: | |
with open("bin/h5/LayaMain.max.js", 'wb') as savefile: | |
savefile.write( | |
proxy.python_save(xmlrpclib.Binary(updatefile.read())).data | |
) | |
# 删除临时上传zip | |
os.remove("upload.zip") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment