Helper to format the platform string in a filename compatible format e.g. "system-version-machine".
(*args)
| 624 | _SIMPLE_SUBSTITUTIONS = str.maketrans(r' /\:;"()', r'_-------') |
| 625 | |
| 626 | def _platform(*args): |
| 627 | |
| 628 | """ Helper to format the platform string in a filename |
| 629 | compatible format e.g. "system-version-machine". |
| 630 | """ |
| 631 | # Format the platform string |
| 632 | platform = '-'.join(x.strip() for x in filter(len, args)) |
| 633 | |
| 634 | # Cleanup some possible filename obstacles... |
| 635 | platform = platform.translate(_SIMPLE_SUBSTITUTIONS) |
| 636 | |
| 637 | # No need to report 'unknown' information... |
| 638 | platform = platform.replace('unknown', '') |
| 639 | |
| 640 | # Fold '--'s and remove trailing '-' |
| 641 | return re.sub(r'-{2,}', '-', platform).rstrip('-') |
| 642 | |
| 643 | def _node(default=''): |
| 644 |