enums.py 9.49 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

19
20
from cerbero.errors import FatalError

21

22
# Safest place to define this since this file imports very few modules
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
23
CERBERO_VERSION = '1.19.1.1'
24

25
26
27
28
class Platform:
    ''' Enumeration of supported platforms '''
    LINUX = 'linux'
    WINDOWS = 'windows'
Andoni Morales Alastruey's avatar
Andoni Morales Alastruey committed
29
    DARWIN = 'darwin'
Sebastian Dröge's avatar
Sebastian Dröge committed
30
    ANDROID = 'android'
Thibault Saunier's avatar
Thibault Saunier committed
31
    IOS = 'ios'
32

Andoni Morales Alastruey's avatar
Andoni Morales Alastruey committed
33

34
35
36
37
class Architecture:
    ''' Enumeration of supported acrchitectures '''
    X86 = 'x86'
    X86_64 = 'x86_64'
38
    UNIVERSAL = 'universal'
Sebastian Dröge's avatar
Sebastian Dröge committed
39
    ARM = 'arm'
40
    ARMv7 = 'armv7'
41
    ARMv7S = 'armv7s'
42
    ARM64 = 'arm64'
43

44
45
    @staticmethod
    def is_arm(arch):
Edward Hervey's avatar
Edward Hervey committed
46
47
48
49
        '''Returns whether the architecture is an ARM based one.
        Note that it will include 32bit *and* 64bit ARM targets. If you
        wish to do something special for 64bit you should first check for
        that before calling this method.'''
50
        return arch in [Architecture.ARM, Architecture.ARMv7,
Edward Hervey's avatar
Edward Hervey committed
51
                Architecture.ARMv7S, Architecture.ARM64]
52

53
54
55
56
    @staticmethod
    def is_arm32(arch):
        return arch in [Architecture.ARM, Architecture.ARMv7, Architecture.ARMv7S]

Andoni Morales Alastruey's avatar
Andoni Morales Alastruey committed
57

58
59
60
class Distro:
    ''' Enumeration of supported distributions '''
    DEBIAN = 'debian'
61
62
63
    REDHAT = 'redhat'
    SUSE = 'suse'
    WINDOWS = 'windows'
64
    ARCH = 'arch'
65
    OS_X = 'osx'
Thibault Saunier's avatar
Thibault Saunier committed
66
    IOS = 'ios'
Sebastian Dröge's avatar
Sebastian Dröge committed
67
    ANDROID = 'android'
68
    GENTOO = 'gentoo'
69
    NONE = 'none'
70

Andoni Morales Alastruey's avatar
Andoni Morales Alastruey committed
71

72
class DistroVersion:
73
74
75
    ''' Enumeration of supported distribution versions, withing each distro, they must be sortable'''
    DEBIAN_SQUEEZE = 'debian_06_squeeze'
    DEBIAN_WHEEZY = 'debian_07_wheezy'
76
    DEBIAN_JESSIE = 'debian_08_jessie'
77
78
    DEBIAN_STRETCH = 'debian_09_stretch'
    DEBIAN_BUSTER = 'debian_10_buster'
79
    DEBIAN_BULLSEYE = 'debian_11_bullseye'
80
    DEBIAN_SID = 'debian_99_sid'
81
82
83
84
85
86
87
88
89
90
91
92
93
    UBUNTU_LUCID = 'ubuntu_10_04_lucid'
    UBUNTU_MAVERICK = 'ubuntu_10_10_maverick'
    UBUNTU_NATTY = 'ubuntu_11_04_natty'
    UBUNTU_ONEIRIC = 'ubuntu_11_10_oneiric'
    UBUNTU_PRECISE = 'ubuntu_12_04_precise'
    UBUNTU_QUANTAL = 'ubuntu_12_10_quantal'
    UBUNTU_RARING = 'ubuntu_13_04_raring'
    UBUNTU_SAUCY = 'ubuntu_13_10_saucy'
    UBUNTU_TRUSTY = 'ubuntu_14_04_trusty'
    UBUNTU_UTOPIC = 'ubuntu_14_10_utopic'
    UBUNTU_VIVID = 'ubuntu_15_04_vivid'
    UBUNTU_WILY = 'ubuntu_15_10_wily'
    UBUNTU_XENIAL = 'ubuntu_16_04_xenial'
Xavier Claessens's avatar
Xavier Claessens committed
94
    UBUNTU_ARTFUL = 'ubuntu_17_10_artful'
95
    UBUNTU_BIONIC = 'ubuntu_18_04_bionic'
Maxim Paymushkin's avatar
Maxim Paymushkin committed
96
    UBUNTU_COSMIC = 'ubuntu_18_10_cosmic'
97
    UBUNTU_DISCO = 'ubuntu_19_04_disco'
Maxim Paymushkin's avatar
Maxim Paymushkin committed
98
    UBUNTU_EOAN = 'ubuntu_19_10_eoan'
Seungha Yang's avatar
Seungha Yang committed
99
    UBUNTU_FOCAL = 'ubuntu_20_04_focal'
100
    FEDORA_16 = 'fedora_16'
101
    FEDORA_17 = 'fedora_17'
102
    FEDORA_18 = 'fedora_18'
Sebastian Dröge's avatar
Sebastian Dröge committed
103
    FEDORA_19 = 'fedora_19'
Thibault Saunier's avatar
Thibault Saunier committed
104
    FEDORA_20 = 'fedora_20'
105
    FEDORA_21 = 'fedora_21'
106
    FEDORA_22 = 'fedora_22'
Olivier Crête's avatar
Olivier Crête committed
107
    FEDORA_23 = 'fedora_23'
108
    FEDORA_24 = 'fedora_24'
109
    FEDORA_25 = 'fedora_25'
110
    FEDORA_26 = 'fedora_26'
Olivier Crête's avatar
Olivier Crête committed
111
    FEDORA_27 = 'fedora_27'
112
    FEDORA_28 = 'fedora_28'
Nicolas Dufresne's avatar
Nicolas Dufresne committed
113
    FEDORA_29 = 'fedora_29'
Olivier Crête's avatar
Olivier Crête committed
114
    FEDORA_30 = 'fedora_30'
115
    FEDORA_31 = 'fedora_31'
116
    FEDORA_32 = 'fedora_32'
117
    # further fedora versions are generated automatically
118
    REDHAT_6 = 'redhat_6'
Olivier Crête's avatar
Olivier Crête committed
119
    REDHAT_7 = 'redhat_7'
120
    REDHAT_8 = 'redhat_8'
121
122
    # Amazon Linux seems to be RedHat/CentOS-based
    AMAZON_LINUX = 'amazon_linux'
123
    AMAZON_LINUX_2 = 'amazon_linux_2'
124
    ARCH_ROLLING = 'rolling'
125
    GENTOO_VERSION = 'gentoo-version'
Georg Lippitsch's avatar
Georg Lippitsch committed
126
    OPENSUSE_42_2 = 'opensuse_42_2'
Georg Lippitsch's avatar
Georg Lippitsch committed
127
    OPENSUSE_42_3 = 'opensuse_42_3'
128
    OPENSUSE_TUMBLEWEED = 'tumbleweed'
129
130
    WINDOWS_XP = 'windows_xp'
    WINDOWS_VISTA = 'windows_vista'
131
132
133
    WINDOWS_7 = 'windows_07'
    WINDOWS_8 = 'windows_08'
    WINDOWS_8_1 = 'windows_08_1'
Sebastian Dröge's avatar
Sebastian Dröge committed
134
    WINDOWS_10 = 'windows_10'
Josep Torra's avatar
Josep Torra committed
135
    OS_X_MAVERICKS = 'osx_mavericks'
136
    OS_X_MOUNTAIN_LION = 'osx_mountain_lion'
137
    OS_X_YOSEMITE = 'osx_yosemite'
138
    OS_X_EL_CAPITAN = 'osx_el_capitan'
Boris Prohaska's avatar
Boris Prohaska committed
139
140
    OS_X_SIERRA = 'osx_sierra'
    OS_X_HIGH_SIERRA = 'osx_high_sierra'
Justin Kim's avatar
Justin Kim committed
141
    OS_X_MOJAVE = 'osx_mojave'
142
    OS_X_CATALINA = 'osx_catalina'
Nirbheek Chauhan's avatar
Nirbheek Chauhan committed
143
    OS_X_BIG_SUR = 'osx_big_sur'
144
145
146
147
148
149
150
151
152
    IOS_8_0 = 'ios_08_0'
    IOS_8_1 = 'ios_08_1'
    IOS_8_2 = 'ios_08_2'
    IOS_8_3 = 'ios_08_3'
    IOS_8_4 = 'ios_08_4'
    IOS_9_0 = 'ios_09_0'
    IOS_9_1 = 'ios_09_1'
    IOS_9_2 = 'ios_09_2'
    IOS_9_3 = 'ios_09_3'
153
    IOS_10_0 = 'ios_10_0'
154
155
    IOS_10_1 = 'ios_10_1'
    IOS_10_2 = 'ios_10_2'
Jan Schmidt's avatar
Jan Schmidt committed
156
    IOS_10_3 = 'ios_10_3'
157
    IOS_11_0 = 'ios_11_0'
158
    IOS_11_1 = 'ios_11_1'
159
    IOS_11_2 = 'ios_11_2'
Edward Hervey's avatar
Edward Hervey committed
160
    IOS_11_3 = 'ios_11_3'
161
    IOS_11_4 = 'ios_11_4'
162
    IOS_12_0 = 'ios_12_0'
163
    IOS_12_1 = 'ios_12_1'
164
    IOS_12_2 = 'ios_12_2'
165
166
    IOS_12_3 = 'ios_12_3'
    IOS_12_4 = 'ios_12_4'
167
    # further ios versions are generated automatically
168
169
170
171
172
    ANDROID_GINGERBREAD = 'android_09_gingerbread'  # API Level 9
    ANDROID_ICE_CREAM_SANDWICH = 'android_14_ice_cream_sandwich'  # API Level 14
    ANDROID_JELLY_BEAN = 'android_16_jelly_bean'  # API Level 16
    ANDROID_KITKAT = 'android_19_kitkat'  # API Level 19
    ANDROID_LOLLIPOP = 'android_21_lollipop' # API Level 21
173
    ANDROID_LOLLIPOP_MR1 = 'android_22_lollipop_mr1' # API Level 22
174
175
    ANDROID_MARSHMALLOW = 'android_23_marshmallow' # API Level 23
    ANDROID_NOUGAT = 'android_24_nougat' # API Level 24
176
    ANDROID_NOUGAT_MR1 = 'android_25_nougat_mr1' # API Level 25
Maxim Paymushkin's avatar
Maxim Paymushkin committed
177
    ANDROID_OREO = 'android_26_oreo' # API Level 26
178
    ANDROID_OREO_MR1 = 'android_27_oreo_mr1' # API Level 27
Maxim Paymushkin's avatar
Maxim Paymushkin committed
179
    ANDROID_PIE = 'android_28_pie' # API Level 28
Maxim Paymushkin's avatar
Maxim Paymushkin committed
180
    ANDROID_Q = 'android_29_q' # API Level 29
181
182
    NONE_UCLIBC = 'none_uclibc'
    NONE_GLIBC = 'none_glibc'
183

184
185
186
187
188
189
190
191
192
193
194
195
196
    @staticmethod
    def get_android_api_version(version):
        '''Returns the corresponding android api version'''
        if version == DistroVersion.ANDROID_GINGERBREAD:
            return 9
        elif version == DistroVersion.ANDROID_ICE_CREAM_SANDWICH:
            return 14
        elif version == DistroVersion.ANDROID_JELLY_BEAN:
            return 16
        elif version == DistroVersion.ANDROID_KITKAT:
            return 19
        elif version == DistroVersion.ANDROID_LOLLIPOP:
            return 21
197
198
        elif version == DistroVersion.ANDROID_LOLLIPOP_MR1:
            return 22
199
200
201
202
        elif version == DistroVersion.ANDROID_MARSHMALLOW:
            return 23
        elif version == DistroVersion.ANDROID_NOUGAT:
            return 24
203
204
        elif version == DistroVersion.ANDROID_NOUGAT_MR1:
            return 25
Maxim Paymushkin's avatar
Maxim Paymushkin committed
205
206
        elif version == DistroVersion.ANDROID_OREO:
            return 26
207
208
        elif version == DistroVersion.ANDROID_OREO_MR1:
            return 27
Maxim Paymushkin's avatar
Maxim Paymushkin committed
209
210
        elif version == DistroVersion.ANDROID_PIE:
            return 28
Maxim Paymushkin's avatar
Maxim Paymushkin committed
211
212
        elif version == DistroVersion.ANDROID_Q:
            return 29
213
214
        else:
            raise FatalError("DistroVersion not supported")
215

216
217
218
219
220
221
    @staticmethod
    def get_ios_sdk_version(version):
        if not version.startswith('ios_'):
            raise FatalError('Not an iOS version: ' + version)
        return [int(s) for s in version[4:].split('_')]

222
223
224
225
226
227
class LicenseDescription:

    def __init__(self, acronym, pretty_name):
        self.acronym = acronym
        self.pretty_name = pretty_name

228
229
230
231
232
    def __lt__(self, other):
        return self.acronym < other.acronym

    def __repr__(self):
        return "LicenseDescription(%s)" % self.acronym
233
234
235
236
237
238
239
240
241
242
243

class License:
    ''' Enumeration of licensesversions '''
    Apachev2 = LicenseDescription('Apache-2.0',
            'Apache License, version 2.0')
    BSD = LicenseDescription('BSD',
            'BSD License')
    BSD_like = LicenseDescription('BSD-like',
            'BSD-like License')
    FreeType = LicenseDescription('FreeType',
            'FreeType License')
244
245
246
247
248
249
250
251
252
253
    GPLv2Plus = LicenseDescription('GPL-2+',
            'GNU General Public License, version 2 or later')
    GPLv3Plus = LicenseDescription('GPL-3+',
            'GNU General Public License, version 3 or later')
    LGPLv2Plus = LicenseDescription('LGPL-2+',
            'GNU Lesser General Public License, version 2 or later')
    LGPLv2_1Plus = LicenseDescription('LGPL-2.1+',
            'GNU Lesser General Public License, version 2.1 or later')
    LGPLv3Plus = LicenseDescription('LGPL-3+',
            'GNU Lesser General Public License, version 3 or later')
254
255
    LibPNG = LicenseDescription('LibPNG',
            'LibPNG License')
Nirbheek Chauhan's avatar
Nirbheek Chauhan committed
256
257
    MPLv1_1 = LicenseDescription('MPL-1.1',
            'Mozilla Public License Version 1.1')
258
259
    MPLv2 = LicenseDescription('MPL-2',
            'Mozilla Public License Version 2.0')
260
261
    MIT = LicenseDescription('MIT',
            'MIT License')
262
263
    OPENSSL = LicenseDescription('OpenSSL',
            'OpenSSL License')
264
265
    Proprietary = LicenseDescription('Proprietary',
            'Proprietary License')
266
    PublicDomain = LicenseDescription('PublicDomain', 'Public Domain')
267
268
    Misc = LicenseDescription('Misc',
            'Miscellaneous license information')
269
270
271
272
273
274

class LibraryType:
    NONE = 'none'
    STATIC = 'static'
    SHARED = 'shared'
    BOTH = 'both'