apache-ignite

Форк
0
118 строк · 3.3 Кб
1
# Licensed to the Apache Software Foundation (ASF) under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#    http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15

16
"""
17
Module contains ignite version utility class.
18
"""
19
import re
20
from distutils.version import LooseVersion
21

22
from ignitetest import __version__
23

24

25
class IgniteVersion(LooseVersion):
26
    """
27
    Container for Ignite versions which makes versions simple to compare.
28

29
    distutils.version.LooseVersion (and StrictVersion) has robust comparison and ordering logic.
30

31
    Example:
32

33
        v27 = IgniteVersion("2.7.0")
34
        v28 = IgniteVersion("2.8.1")
35
        assert v28 > v27  # assertion passes!
36
    """
37

38
    DEV_VERSION = "dev"
39
    DEFAULT_PROJECT = "ignite"
40

41
    def __init__(self, vstring=None):
42
        if vstring == self.DEV_VERSION:
43
            self.project = self.DEFAULT_PROJECT
44
            version = vstring
45
        else:
46
            match = re.match(r'([a-zA-Z]*)-*([\d(dev)]+.*)', vstring)
47
            self.project = self.DEFAULT_PROJECT if not match.group(1) else match.group(1)
48
            version = match.group(2)
49

50
        self.is_dev = version == self.DEV_VERSION
51

52
        if self.is_dev:
53
            version = __version__  # we may also parse pom file to gain correct version (in future)
54

55
        super().__init__(version)
56

57
    def __str__(self):
58
        return "%s-%s" % (self.project, "dev" if self.is_dev else super().__str__())
59

60
    def _cmp(self, other):
61
        if isinstance(other, str):
62
            other = IgniteVersion(other)
63

64
        # todo solve comparability issues and uncomment the following
65
        # if self.project != other.project:
66
        #     raise Exception("Incomperable versons v1=%s, v2=%s because of different projects" % (self, other))
67

68
        return super()._cmp(other)
69

70
    def __repr__(self):
71
        return "IgniteVersion ('%s')" % str(self)
72

73

74
DEV_BRANCH = IgniteVersion("dev")
75

76
# 2.7.x versions
77
V_2_7_6 = IgniteVersion("2.7.6")
78
LATEST_2_7 = V_2_7_6
79

80
# 2.8.x versions
81
V_2_8_0 = IgniteVersion("2.8.0")
82
V_2_8_1 = IgniteVersion("2.8.1")
83
LATEST_2_8 = V_2_8_1
84

85
# 2.9.x versions
86
V_2_9_0 = IgniteVersion("2.9.0")
87
V_2_9_1 = IgniteVersion("2.9.1")
88
LATEST_2_9 = V_2_9_1
89

90
# 2.10.x versions
91
V_2_10_0 = IgniteVersion("2.10.0")
92
LATEST_2_10 = V_2_10_0
93

94
# 2.11.x versions
95
V_2_11_0 = IgniteVersion("2.11.0")
96
V_2_11_1 = IgniteVersion("2.11.1")
97
LATEST_2_11 = V_2_11_1
98

99
# 2.12.x versions
100
V_2_12_0 = IgniteVersion("2.12.0")
101
LATEST_2_12 = V_2_12_0
102

103
# 2.13.x versions
104
V_2_13_0 = IgniteVersion("2.13.0")
105
LATEST_2_13 = V_2_13_0
106

107
# 2.14.x versions
108
V_2_14_0 = IgniteVersion("2.14.0")
109
LATEST_2_14 = V_2_14_0
110

111
# 2.15.x versions
112
V_2_15_0 = IgniteVersion("2.15.0")
113
LATEST_2_15 = V_2_15_0
114

115
# if you updated the LATEST version
116
# please check DEV version in 'tests/ignitetest/__init__.py'
117
LATEST = LATEST_2_15
118
OLDEST = V_2_7_6
119

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.