From fc4dd1c8f7165286c93b5a13a17ad5cc3e17e758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 11 Nov 2024 16:23:14 +0100 Subject: [PATCH] Fix compatibility with pygit2 < 1.14 --- conda_smithy/feedstock_io.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/conda_smithy/feedstock_io.py b/conda_smithy/feedstock_io.py index 3f07829e2..900fbdc01 100644 --- a/conda_smithy/feedstock_io.py +++ b/conda_smithy/feedstock_io.py @@ -12,9 +12,12 @@ def get_repo(path, search_parent_directories=True): if search_parent_directories: path = pygit2.discover_repository(path) if path is not None: - repo = pygit2.Repository( - path, pygit2.enums.RepositoryOpenFlag.NO_SEARCH - ) + try: + no_search = pygit2.enums.RepositoryOpenFlag.NO_SEARCH + except AttributeError: # pygit2 < 1.14 + no_search = pygit2.GIT_REPOSITORY_OPEN_NO_SEARCH + + repo = pygit2.Repository(path, no_search) except ImportError: pass except pygit2.GitError: