diff --git a/download-deps.py b/download-deps.py index bd48c13631..835e257f5b 100755 --- a/download-deps.py +++ b/download-deps.py @@ -34,7 +34,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************""" -import os.path,zipfile +import os.path +import zipfile import shutil import sys import traceback @@ -48,18 +49,26 @@ from sys import stdout from distutils.errors import DistutilsError from distutils.dir_util import copy_tree, remove_tree + class UnrecognizedFormat: def __init__(self, prompt): self._prompt = prompt + def __str__(self): return self._prompt + 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._config_path = config_path self._version_path = version_path + print self._config_path + print self._version_path + + adfasdf() + data = self.load_json_file(config_path) self._current_version = data["version"] @@ -76,7 +85,7 @@ class CocosZipInstaller(object): try: data = self.load_json_file(version_path) - if remote_version_key == None: + if remote_version_key is None: self._remote_version = data["version"] else: self._remote_version = data[remote_version_key] @@ -117,7 +126,7 @@ class CocosZipInstaller(object): file_size_dl = 0 block_sz = 8192 block_size_per_second = 0 - old_time=time() + old_time = time() while True: buffer = u.read(block_sz) @@ -192,7 +201,6 @@ class CocosZipInstaller(object): z.close() print("==> Extraction done!") - 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 = ret.strip() @@ -200,7 +208,7 @@ class CocosZipInstaller(object): print("==> Cache the dependency libraries by default") return False 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): if not os.path.isfile(self._filename): @@ -260,7 +268,7 @@ class CocosZipInstaller(object): if os.path.exists(self._extracted_folder_name): shutil.rmtree(self._extracted_folder_name) if os.path.isfile(self._filename): - if remove_downloaded != None: + if remove_downloaded is not None: if remove_downloaded == 'yes': os.remove(self._filename) elif self.ask_to_delete_downloaded_zip_file(): @@ -278,6 +286,7 @@ def _check_python_version(): return True + def main(): workpath = os.path.dirname(os.path.realpath(__file__)) @@ -303,7 +312,7 @@ def main(): print("==> Prepare to download external libraries!") 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.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("==> Prepare to download lua runtime binaries") diff --git a/external/config.json b/external/config.json index 12687e3db9..a5c4c73a5e 100644 --- a/external/config.json +++ b/external/config.json @@ -1,5 +1,5 @@ { - "version":"v3-deps-20", + "version":"v3-deps-21", "zip_file_size":"87419231", "repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_parent":"https://github.com/cocos2d/",