From fd24dc8e369481e9f895d4458df0796e1fadc27d Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Mon, 16 Aug 2021 18:23:53 +0800 Subject: [PATCH] feat(mge/hub/fetcher): add checking of mge version GitOrigin-RevId: 808af7f82ad1c1825f6dbd354b6b47e6dbec05a9 --- imperative/python/megengine/hub/fetcher.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/imperative/python/megengine/hub/fetcher.py b/imperative/python/megengine/hub/fetcher.py index 9c755150f..65fcfbe59 100644 --- a/imperative/python/megengine/hub/fetcher.py +++ b/imperative/python/megengine/hub/fetcher.py @@ -18,6 +18,7 @@ from zipfile import ZipFile import requests from tqdm import tqdm +from megengine import __version__ from megengine.utils.http_download import ( CHUNK_SIZE, HTTP_CONNECTION_TIMEOUT, @@ -129,7 +130,9 @@ class GitSSHFetcher(RepoFetcherBase): repo_dir_raw = "{}_{}_{}".format( repo_owner, repo_name, normalized_branch_info ) + ("_{}".format(commit) if commit else "") - repo_dir = cls._gen_repo_dir(repo_dir_raw) + repo_dir = ( + "_".join(__version__.split(".")) + "_" + cls._gen_repo_dir(repo_dir_raw) + ) git_url = "git@{}:{}/{}.git".format(git_host, repo_owner, repo_name) if use_cache and os.path.exists(repo_dir): # use cache @@ -242,7 +245,9 @@ class GitHTTPSFetcher(RepoFetcherBase): repo_dir_raw = "{}_{}_{}".format( repo_owner, repo_name, normalized_branch_info ) + ("_{}".format(commit) if commit else "") - repo_dir = cls._gen_repo_dir(repo_dir_raw) + repo_dir = ( + "_".join(__version__.split(".")) + "_" + cls._gen_repo_dir(repo_dir_raw) + ) archive_url = cls._git_archive_link( git_host, repo_owner, repo_name, branch_info, commit ) -- GitLab