提交 4a0cfef6 编写于 作者: W wuzewu

Remove gitpython dependency.

上级 3346ba0b
...@@ -21,12 +21,6 @@ import sys ...@@ -21,12 +21,6 @@ import sys
from collections import OrderedDict from collections import OrderedDict
from typing import List from typing import List
# For some environments where git is not installed, we need to set this environment
# variable to avoid errors.
os.environ['GIT_PYTHON_REFRESH'] = 'quiet'
import git
from git import Repo
from paddlehub.module.module import RunModule from paddlehub.module.module import RunModule
from paddlehub.env import SOURCES_HOME from paddlehub.env import SOURCES_HOME
from paddlehub.utils import log, utils from paddlehub.utils import log, utils
...@@ -42,6 +36,11 @@ class GitSource(object): ...@@ -42,6 +36,11 @@ class GitSource(object):
''' '''
def __init__(self, url: str, path: str = None): def __init__(self, url: str, path: str = None):
# For some environments where git is not installed, we need to set this environment
# variable to avoid errors.
os.environ['GIT_PYTHON_REFRESH'] = 'quiet'
from git import Repo
self.url = url self.url = url
self.path = os.path.join(SOURCES_HOME, utils.md5(url)) self.path = os.path.join(SOURCES_HOME, utils.md5(url))
...@@ -152,6 +151,8 @@ class GitSource(object): ...@@ -152,6 +151,8 @@ class GitSource(object):
Args: Args:
url(str) : Url to check url(str) : Url to check
''' '''
import git
try: try:
git.cmd.Git().ls_remote(url) git.cmd.Git().ls_remote(url)
return True return True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册