Thanks to visit codestin.com
Credit goes to github.com

Skip to content

make libgit version access similar to how python handles it #845

@imbuedhope

Description

@imbuedhope

When checking the version of python you can do something like

import sys
if sys.version < (3,5):
    raise ImportError('Upgrade to python 3.5 or newer')

The equivalent for pygit2 seems to be something like

import pygit2
if (pygit2.LIBGIT2_VER_MAJOR, pygit2.LIBGIT2_VER_MINOR, pygit2.LIBGIT2_VER_REVISION) < (0, 26):
    raise ImportError('Upgrade libgit2 to version 0.26 or nerwer (and pygit2 to match)')

or something like

import pygit2
if tuple(int(n) for n in pygit2.LIBGIT2_VERSION.split('.')) < (0,26):
    raise ImportError('Upgrade libgit2 to version 0.26 or nerwer (and pygit2 to match)')

It would be nice to have a variable that is a tuple builtin to pygit2 going forward. Support for something like this maybe?

import pygit2
if pygit2.LIBGIT2_VERSION_TUPLE < (0,26):
    raise ImportError('Upgrade libgit2 to version 0.26 or nerwer (and pygit2 to match)')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions