From c94d5dd32da3f40dc0f2465298d65334f74f4c93 Mon Sep 17 00:00:00 2001 From: Julen Landa Alustiza Date: Dec 11 2019 11:19:48 +0000 Subject: [PATCH 1/2] Remove old libgit2 version based pygit2 installation --- diff --git a/dev/containers/fedora-pip-py3 b/dev/containers/fedora-pip-py3 index fe35f73..7a7cdf6 100644 --- a/dev/containers/fedora-pip-py3 +++ b/dev/containers/fedora-pip-py3 @@ -25,11 +25,6 @@ RUN cd / \ && GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone -b $BRANCH $REPO \ && chmod +x /pagure/dev/containers/tox_py3.sh -# Install pygit2 manually, outside of the virtualenv since it is tightly coupled -# which the version of libgit2 installed on the system. -RUN pip3 install "pygit2 <= `rpm -q libgit2 --queryformat='%{version}'`" && \ - cd /pagure - WORKDIR /pagure ENTRYPOINT ["/pagure/dev/containers/tox_py3.sh"] CMD [] From d7427a009f244611061efb17d2530ae3fed05e4b Mon Sep 17 00:00:00 2001 From: Julen Landa Alustiza Date: Dec 11 2019 11:35:28 +0000 Subject: [PATCH 2/2] doc_server: pygit2 1.0.0 support --- diff --git a/pagure/docs_server.py b/pagure/docs_server.py index 3878afc..fd7b277 100644 --- a/pagure/docs_server.py +++ b/pagure/docs_server.py @@ -120,7 +120,13 @@ def __get_tree_and_content(repo_obj, commit, path): # Not tested and no idea how to test it, but better safe than sorry flask.abort(404, description="File not found") - if isinstance(blob_or_tree, pygit2.TreeEntry): # Returned a file + is_file = False + try: + is_file = isinstance(blob_or_tree, pygit2.TreeEntry) + except AttributeError: + is_file = isinstance(blob_or_tree, pygit2.Blob) + + if is_file: filename = blob_or_tree.name name, ext = os.path.splitext(filename) blob_obj = repo_obj[blob_or_tree.oid]