From a6fd7134d03fe39760654d63a9c279c0bd92afd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Mon, 22 May 2023 16:10:01 +0200 Subject: [PATCH] fix: use git cli to obtain recipe commit sha, since there seems to be no fast and correct way to do that with gitpython (#892) --- bioconda_utils/build_failure.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bioconda_utils/build_failure.py b/bioconda_utils/build_failure.py index f15366050b..f068c879f5 100644 --- a/bioconda_utils/build_failure.py +++ b/bioconda_utils/build_failure.py @@ -1,6 +1,7 @@ import os from typing import Optional, Union from bioconda_utils.githandler import GitHandler +import subprocess as sp from ruamel.yaml import YAML, CommentedMap import conda.exports @@ -39,10 +40,8 @@ def get_recipe_commit_sha(self): if self.git_handler is None: self.git_handler = GitHandler() # Get last commit sha of recipe - commit = self.git_handler.repo.head.commit - tree = commit.tree - file_blob = tree[os.path.join(self.recipe_path, "meta.yaml")] - commit_sha = file_blob.binsha.hex() + filepath = os.path.join(self.recipe_path, "meta.yaml") + commit_sha = sp.run(["git", "rev-list", "-1", "HEAD", filepath], check=True, capture_output=True).stdout.decode().strip() return commit_sha def skiplists_current_recipe(self):