1
0
Fork 0
mirror of https://github.com/fastogt/pyfastogt synced 2025-03-09 23:38:55 +00:00

git clone branch

This commit is contained in:
topilski 2018-02-10 05:43:58 +03:00
parent 4ec5a987aa
commit 34f6a30d20

View file

@ -164,8 +164,11 @@ def build_from_sources(url, compiler_flags: CompileInfo, source_dir_path, prefix
shutil.rmtree(extracted_folder) shutil.rmtree(extracted_folder)
def git_clone(url: str, current_dir: str, remove_dot_git=True): def git_clone(url: str, current_dir: str, branch=None, remove_dot_git=True):
common_git_clone_line = ['git', 'clone', '--depth=1', url] if branch:
common_git_clone_line = ['git', 'clone', '--branch', branch, '--single-branch', url]
else:
common_git_clone_line = ['git', 'clone', '--depth=1', url]
cloned_dir = os.path.splitext(url.rsplit('/', 1)[-1])[0] cloned_dir = os.path.splitext(url.rsplit('/', 1)[-1])[0]
common_git_clone_line.append(cloned_dir) common_git_clone_line.append(cloned_dir)
subprocess.call(common_git_clone_line) subprocess.call(common_git_clone_line)