Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
utils.Version Class Reference
Inheritance diagram for utils.Version:

Public Member Functions

def __init__ (self, channel=None, major=None, minor=None, patch=None, prerelease=None, prerelease_patch=None, version=None)
 
def set_version (self, version)
 
def __str__ (self)
 
def __eq__ (self, other)
 
def __lt__ (self, other)
 

Public Attributes

 channel
 
 major
 
 minor
 
 patch
 
 prerelease
 
 prerelease_patch
 

Detailed Description

Definition at line 141 of file utils.py.

Constructor & Destructor Documentation

◆ __init__()

def utils.Version.__init__ (   self,
  channel = None,
  major = None,
  minor = None,
  patch = None,
  prerelease = None,
  prerelease_patch = None,
  version = None 
)

Definition at line 143 of file utils.py.

150 version=None):
151 self.channel = channel
152 self.major = major
153 self.minor = minor
154 self.patch = patch
155 self.prerelease = prerelease
156 self.prerelease_patch = prerelease_patch
157 if version:
158 self.set_version(version)
159

Member Function Documentation

◆ __eq__()

def utils.Version.__eq__ (   self,
  other 
)

Definition at line 182 of file utils.py.

182 def __eq__(self, other):
183 return self.channel == other.channel and \
184 self.major == other.major and \
185 self.minor == other.minor and \
186 self.patch == other.patch and \
187 self.prerelease == other.prerelease and \
188 self.prerelease_patch == other.prerelease_patch
189

◆ __lt__()

def utils.Version.__lt__ (   self,
  other 
)

Definition at line 190 of file utils.py.

190 def __lt__(self, other):
191 if int(self.major) < int(other.major):
192 return True
193 if int(self.major) > int(other.major):
194 return False
195 if int(self.minor) < int(other.minor):
196 return True
197 if int(self.minor) > int(other.minor):
198 return False
199 if int(self.patch) < int(other.patch):
200 return True
201 if int(self.patch) > int(other.patch):
202 return False
203 # The stable channel is ahead of the other channels on the same triplet.
204 if self.channel != 'stable' and other.channel == 'stable':
205 return True
206 if self.channel == 'stable' and other.channel != 'stable':
207 return False
208 # The main channel is ahead of the other channels on the same triplet.
209 if self.channel != 'main' and other.channel == 'main':
210 return True
211 if self.channel == 'main' and other.channel != 'main':
212 return False
213 # The be channel existed before it was renamed to main.
214 if self.channel != 'be' and other.channel == 'be':
215 return True
216 if self.channel == 'be' and other.channel != 'be':
217 return False
218 if int(self.prerelease) < int(other.prerelease):
219 return True
220 if int(self.prerelease) > int(other.prerelease):
221 return False
222 if int(self.prerelease_patch) < int(other.prerelease_patch):
223 return True
224 if int(self.prerelease_patch) > int(other.prerelease_patch):
225 return False
226 return False
227
228
229# Try to guess the host operating system.

◆ __str__()

def utils.Version.__str__ (   self)

Definition at line 175 of file utils.py.

175 def __str__(self):
176 result = '%s.%s.%s' % (self.major, self.minor, self.patch)
177 if self.channel != 'stable':
178 result += '-%s.%s.%s' % (self.prerelease, self.prerelease_patch,
179 self.channel)
180 return result
181

◆ set_version()

def utils.Version.set_version (   self,
  version 
)

Definition at line 160 of file utils.py.

160 def set_version(self, version):
161 match = re.match(SEMANTIC_VERSION_PATTERN, version)
162 assert match, '%s must be a valid version' % version
163 self.channel = 'stable'
164 self.major = match['major']
165 self.minor = match['minor']
166 self.patch = match['patch']
167 self.prerelease = '0'
168 self.prerelease_patch = '0'
169 if match['prerelease']:
170 subversions = match['prerelease'].split('.')
171 self.prerelease = subversions[0]
172 self.prerelease_patch = subversions[1]
173 self.channel = subversions[2]
174

Member Data Documentation

◆ channel

utils.Version.channel

Definition at line 151 of file utils.py.

◆ major

utils.Version.major

Definition at line 152 of file utils.py.

◆ minor

utils.Version.minor

Definition at line 153 of file utils.py.

◆ patch

utils.Version.patch

Definition at line 154 of file utils.py.

◆ prerelease

utils.Version.prerelease

Definition at line 155 of file utils.py.

◆ prerelease_patch

utils.Version.prerelease_patch

Definition at line 156 of file utils.py.


The documentation for this class was generated from the following file: