(firstline)
| 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) |
no test coverage detected