Skip to content

Commit fc4dd1c

Browse files
committed
Fix compatibility with pygit2 < 1.14
1 parent 6b820d7 commit fc4dd1c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

conda_smithy/feedstock_io.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ def get_repo(path, search_parent_directories=True):
1212
if search_parent_directories:
1313
path = pygit2.discover_repository(path)
1414
if path is not None:
15-
repo = pygit2.Repository(
16-
path, pygit2.enums.RepositoryOpenFlag.NO_SEARCH
17-
)
15+
try:
16+
no_search = pygit2.enums.RepositoryOpenFlag.NO_SEARCH
17+
except AttributeError: # pygit2 < 1.14
18+
no_search = pygit2.GIT_REPOSITORY_OPEN_NO_SEARCH
19+
20+
repo = pygit2.Repository(path, no_search)
1821
except ImportError:
1922
pass
2023
except pygit2.GitError:

0 commit comments

Comments
 (0)