MCPcopy Index your code
hub / github.com/aws/aws-cli / _parse_release_file

Function _parse_release_file

awscli/compat.py:535–559  ·  view source on GitHub ↗
(firstline)

Source from the content-addressed store, hash-verified

533 )
534
535 def _parse_release_file(firstline):
536 # Default to empty 'version' and 'id' strings. Both defaults are used
537 # when 'firstline' is empty. 'id' defaults to empty when an id can not
538 # be deduced.
539 version = ''
540 id = ''
541
542 # Parse the first line
543 m = _lsb_release_version.match(firstline)
544 if m is not None:
545 # LSB format: "distro release x.x (codename)"
546 return tuple(m.groups())
547
548 # Pre-LSB format: "distro x.x (codename)"
549 m = _release_version.match(firstline)
550 if m is not None:
551 return tuple(m.groups())
552
553 # Unknown format... take the first two words
554 l = firstline.strip().split()
555 if l:
556 version = l[0]
557 if len(l) > 1:
558 id = l[1]
559 return '', version, id
560
561 _distributor_id_file_re = re.compile(r"(?:DISTRIB_ID\s*=)\s*(.*)", re.I)
562 _release_file_re = re.compile(r"(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I)

Callers 1

_linux_distributionFunction · 0.85

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected