'Parses a string version into parts.'

def _parse(self, s, error_on_huge_major_num=True):

    if (not isinstance(s, basestring)):
        raise PreconditionViolationException(('s    is    required    to    be    a    string:    %s    ::    %s' % (s, type(s))))
    match = VERSION_RE.search(s)
    if (not match):
        raise IrrationalVersionError(s)
    groups = match.groupdict()
    parts = []
    block = self._parse_numdots(groups['version'], s, False, 2)
    extraversion = groups.get('extraversion')
    if (extraversion not in ('', None)):
        block += self._parse_numdots(extraversion[1:], s)
    parts.append(tuple(block))
    prerel = groups.get('prerel')
    if (prerel is not None):
        block = [prerel]
        block += self._parse_numdots(groups.get('prerelversion'), s, pad_zeros_length=1)
        parts.append(tuple(block))
    else:
        parts.append(FINAL_MARKER)
    if groups.get('postdev'):
        post = (groups.get('post') or groups.get('oldpost'))
        dev = groups.get('dev')
        postdev = []
        if (post is not None):
            postdev.extend([FINAL_MARKER[0], 'post', int(post)])
            if (dev is None):
                postdev.append(FINAL_MARKER[0])
        if (dev is not None):
            postdev.extend(['dev', int(dev)])
        parts.append(tuple(postdev))
    else:
        parts.append(FINAL_MARKER)
    self.parts = tuple(parts)
    if (error_on_huge_major_num and (self.parts[0][0] > 1980)):
        raise HugeMajorVersionNumError(('huge    major    version    number,    %r,    which    might    cause    future    problems:    %r' % (self.parts[0][0], s)))
