Tries some special tricks to get the distribution information in case the default method fails. Currently supports older SuSE Linux, Caldera OpenLinux and Slackware Linux distributions.
(distname, version, id)
| 454 | _UNIXCONFDIR = '/etc' |
| 455 | |
| 456 | def _dist_try_harder(distname, version, id): |
| 457 | """Tries some special tricks to get the distribution |
| 458 | information in case the default method fails. |
| 459 | Currently supports older SuSE Linux, Caldera OpenLinux and |
| 460 | Slackware Linux distributions. |
| 461 | """ |
| 462 | if os.path.exists('/var/adm/inst-log/info'): |
| 463 | # SuSE Linux stores distribution information in that file |
| 464 | distname = 'SuSE' |
| 465 | with open('/var/adm/inst-log/info') as f: |
| 466 | for line in f: |
| 467 | tv = line.split() |
| 468 | if len(tv) == 2: |
| 469 | tag, value = tv |
| 470 | else: |
| 471 | continue |
| 472 | if tag == 'MIN_DIST_VERSION': |
| 473 | version = value.strip() |
| 474 | elif tag == 'DIST_IDENT': |
| 475 | values = value.split('-') |
| 476 | id = values[2] |
| 477 | return distname, version, id |
| 478 | |
| 479 | if os.path.exists('/etc/.installed'): |
| 480 | # Caldera OpenLinux has some infos in that file (thanks to Colin Kong) |
| 481 | with open('/etc/.installed') as f: |
| 482 | for line in f: |
| 483 | pkg = line.split('-') |
| 484 | if len(pkg) >= 2 and pkg[0] == 'OpenLinux': |
| 485 | # XXX does Caldera support non Intel platforms ? If yes, |
| 486 | # where can we find the needed id ? |
| 487 | return 'OpenLinux', pkg[1], id |
| 488 | |
| 489 | if os.path.isdir('/usr/lib/setup'): |
| 490 | # Check for slackware version tag file (thanks to Greg Andruk) |
| 491 | verfiles = os.listdir('/usr/lib/setup') |
| 492 | for n in range(len(verfiles) - 1, -1, -1): |
| 493 | if verfiles[n][:14] != 'slack-version-': |
| 494 | del verfiles[n] |
| 495 | if verfiles: |
| 496 | verfiles.sort() |
| 497 | distname = 'slackware' |
| 498 | version = verfiles[-1][14:] |
| 499 | return distname, version, id |
| 500 | |
| 501 | return distname, version, id |
| 502 | |
| 503 | _release_filename = re.compile(r'(\w+)[-_](release|version)', re.ASCII) |
| 504 | _lsb_release_version = re.compile( |
no test coverage detected