externals: using v21

This commit is contained in:
Ricardo Quesada 2014-11-14 15:31:48 -08:00
parent 4ab77acd57
commit 8fd633926f
2 changed files with 18 additions and 9 deletions

View File

@ -34,7 +34,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************""" ****************************************************************************"""
import os.path,zipfile import os.path
import zipfile
import shutil import shutil
import sys import sys
import traceback import traceback
@ -48,18 +49,26 @@ from sys import stdout
from distutils.errors import DistutilsError from distutils.errors import DistutilsError
from distutils.dir_util import copy_tree, remove_tree from distutils.dir_util import copy_tree, remove_tree
class UnrecognizedFormat: class UnrecognizedFormat:
def __init__(self, prompt): def __init__(self, prompt):
self._prompt = prompt self._prompt = prompt
def __str__(self): def __str__(self):
return self._prompt return self._prompt
class CocosZipInstaller(object): class CocosZipInstaller(object):
def __init__(self, workpath, config_path, version_path, remote_version_key = None): def __init__(self, workpath, config_path, version_path, remote_version_key=None):
self._workpath = workpath self._workpath = workpath
self._config_path = config_path self._config_path = config_path
self._version_path = version_path self._version_path = version_path
print self._config_path
print self._version_path
adfasdf()
data = self.load_json_file(config_path) data = self.load_json_file(config_path)
self._current_version = data["version"] self._current_version = data["version"]
@ -76,7 +85,7 @@ class CocosZipInstaller(object):
try: try:
data = self.load_json_file(version_path) data = self.load_json_file(version_path)
if remote_version_key == None: if remote_version_key is None:
self._remote_version = data["version"] self._remote_version = data["version"]
else: else:
self._remote_version = data[remote_version_key] self._remote_version = data[remote_version_key]
@ -117,7 +126,7 @@ class CocosZipInstaller(object):
file_size_dl = 0 file_size_dl = 0
block_sz = 8192 block_sz = 8192
block_size_per_second = 0 block_size_per_second = 0
old_time=time() old_time = time()
while True: while True:
buffer = u.read(block_sz) buffer = u.read(block_sz)
@ -192,7 +201,6 @@ class CocosZipInstaller(object):
z.close() z.close()
print("==> Extraction done!") print("==> Extraction done!")
def ask_to_delete_downloaded_zip_file(self): def ask_to_delete_downloaded_zip_file(self):
ret = self.get_input_value("==> Do you want to keep '%s'? So you don't have to download it later. (yes/no): " % self._filename) ret = self.get_input_value("==> Do you want to keep '%s'? So you don't have to download it later. (yes/no): " % self._filename)
ret = ret.strip() ret = ret.strip()
@ -200,7 +208,7 @@ class CocosZipInstaller(object):
print("==> Cache the dependency libraries by default") print("==> Cache the dependency libraries by default")
return False return False
else: else:
return True if ret == 'no' or ret =='n' else False return True if ret == 'no' or ret == 'n' else False
def download_zip_file(self): def download_zip_file(self):
if not os.path.isfile(self._filename): if not os.path.isfile(self._filename):
@ -260,7 +268,7 @@ class CocosZipInstaller(object):
if os.path.exists(self._extracted_folder_name): if os.path.exists(self._extracted_folder_name):
shutil.rmtree(self._extracted_folder_name) shutil.rmtree(self._extracted_folder_name)
if os.path.isfile(self._filename): if os.path.isfile(self._filename):
if remove_downloaded != None: if remove_downloaded is not None:
if remove_downloaded == 'yes': if remove_downloaded == 'yes':
os.remove(self._filename) os.remove(self._filename)
elif self.ask_to_delete_downloaded_zip_file(): elif self.ask_to_delete_downloaded_zip_file():
@ -278,6 +286,7 @@ def _check_python_version():
return True return True
def main(): def main():
workpath = os.path.dirname(os.path.realpath(__file__)) workpath = os.path.dirname(os.path.realpath(__file__))
@ -303,7 +312,7 @@ def main():
print("==> Prepare to download external libraries!") print("==> Prepare to download external libraries!")
external_path = os.path.join(workpath, 'external') external_path = os.path.join(workpath, 'external')
installer = CocosZipInstaller(workpath, os.path.join(workpath, 'external', 'config.json'), os.path.join(workpath, 'external', 'version.json'), "prebuilt_libs_version") installer = CocosZipInstaller(workpath, os.path.join(workpath, 'external', 'config.json'), os.path.join(workpath, 'external', 'version.json'), "prebuilt_libs_version")
installer.run(workpath,external_path, opts.remove_downloaded, opts.force_update, opts.download_only) installer.run(workpath, external_path, opts.remove_downloaded, opts.force_update, opts.download_only)
print("=======================================================") print("=======================================================")
print("==> Prepare to download lua runtime binaries") print("==> Prepare to download lua runtime binaries")

View File

@ -1,5 +1,5 @@
{ {
"version":"v3-deps-20", "version":"v3-deps-21",
"zip_file_size":"87419231", "zip_file_size":"87419231",
"repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_name":"cocos2d-x-3rd-party-libs-bin",
"repo_parent":"https://github.com/cocos2d/", "repo_parent":"https://github.com/cocos2d/",