summaryrefslogtreecommitdiff
path: root/semantic_version/compat.py
blob: 51102fc9ee9c022a24c0bc141eec6e99731d4ee4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2013 Raphaƫl Barrois
# This code is distributed under the two-clause BSD License.

import sys

is_python2 = (sys.version_info[0] == 2)

if is_python2:  # pragma: no cover
    base_cmp = cmp
else:  # pragma: no cover
    def base_cmp(x, y):
        if x < y:
            return -1
        elif x > y:
            return 1
        else:
            return 0