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