Package the binary files of cocos2d-console in git-achive-all.

This commit is contained in:
zhangbin 2014-05-19 13:48:50 +08:00
parent 732cc9dd1e
commit d9e226f886
2 changed files with 16 additions and 2 deletions

View File

@ -10,6 +10,11 @@
"zip_config_path": "../../templates/lua-template-runtime/runtime/config.json", "zip_config_path": "../../templates/lua-template-runtime/runtime/config.json",
"zip_file_path": "../../", "zip_file_path": "../../",
"extract_to_zip_path": "templates/lua-template-runtime/runtime" "extract_to_zip_path": "templates/lua-template-runtime/runtime"
},
{
"zip_config_path": "../cocos2d-console/config.json",
"zip_file_path": "../cocos2d-console",
"extract_to_zip_path": "tools/cocos2d-console"
} }
] ]
} }

View File

@ -14,6 +14,11 @@ import traceback
from os import path, extsep from os import path, extsep
from subprocess import Popen, PIPE, CalledProcessError from subprocess import Popen, PIPE, CalledProcessError
class UnrecognizedFormat:
def __init__(self, prompt):
self._prompt = prompt
def __str__(self):
return self._prompt
class GitArchiver(object): class GitArchiver(object):
""" """
@ -97,7 +102,7 @@ class GitArchiver(object):
import zipfile import zipfile
if not zipfile.is_zipfile(zip_file_path): if not zipfile.is_zipfile(zip_file_path):
raise UnrecognizedFormat("%s is not a zip file" % (self._filename)) raise UnrecognizedFormat("%s is not a zip file" % zip_file_path)
file_paths = [] file_paths = []
print("==> Extracting files, please wait ...") print("==> Extracting files, please wait ...")
@ -204,6 +209,10 @@ class GitArchiver(object):
import subprocess import subprocess
subprocess.call("python %s -d -f" % (path.join(self.main_repo_abspath, "download-deps.py")), shell=True, cwd=self.main_repo_abspath) subprocess.call("python %s -d -f" % (path.join(self.main_repo_abspath, "download-deps.py")), shell=True, cwd=self.main_repo_abspath)
# Execute download-bin.py in cocos2d-console folder
console_path = path.join(self.main_repo_abspath, "tools", "cocos2d-console")
subprocess.call("python %s -d -f" % (path.join(console_path, "download-bin.py")), shell=True, cwd=console_path)
# Check config.json to insert a zip file content to the final generated zip file # Check config.json to insert a zip file content to the final generated zip file
extra_folders = [] extra_folders = []
config_data = self.load_json_file("config.json") config_data = self.load_json_file("config.json")
@ -212,7 +221,7 @@ class GitArchiver(object):
zip_config = self.load_json_file(zip_file["zip_config_path"]) zip_config = self.load_json_file(zip_file["zip_config_path"])
zip_file_name = zip_config["version"] + '.zip' zip_file_name = zip_config["version"] + '.zip'
extra_to_zip_file = zip_file["extract_to_zip_path"] extra_to_zip_file = zip_file["extract_to_zip_path"]
zip_file_path = os.path.join(zip_file["zip_file_path"] + zip_file_name) zip_file_path = os.path.join(zip_file["zip_file_path"], zip_file_name)
# 'v' letter was swallowed by github, so we need to substring it from the 2nd letter # 'v' letter was swallowed by github, so we need to substring it from the 2nd letter
extra_folder_name = zip_config["repo_name"] + '-' + zip_config["version"][1:] extra_folder_name = zip_config["repo_name"] + '-' + zip_config["version"][1:]
extra_folder_path = os.path.join(self.main_repo_abspath, extra_folder_name) extra_folder_path = os.path.join(self.main_repo_abspath, extra_folder_name)