| @@ 488-506 (lines=19) @@ | ||
| 485 | xec.submit(gpgfile, thepath, gpg, keyid, pword) |
|
| 486 | except Exception as exc: |
|
| 487 | print("SOMETHING WENT WRONG") |
|
| 488 | print(str(exc)) |
|
| 489 | raise SystemExit |
|
| 490 | ||
| 491 | ||
| 492 | def gpg_config_loader(homepath=None): |
|
| 493 | """ |
|
| 494 | Read a ConfigParser file to get PGP key, password (optional) |
|
| 495 | ||
| 496 | :param homepath: Folder containing ini file. Default is user directory. |
|
| 497 | :type homepath: str |
|
| 498 | """ |
|
| 499 | config = configparser.ConfigParser() |
|
| 500 | if homepath is None: |
|
| 501 | homepath = os.path.expanduser("~") |
|
| 502 | conffile = os.path.join(homepath, "bbarchivist.ini") |
|
| 503 | if not os.path.exists(conffile): |
|
| 504 | open(conffile, 'w').close() |
|
| 505 | config.read(conffile) |
|
| 506 | if not config.has_section('gpgrunner'): |
|
| 507 | config['gpgrunner'] = {} |
|
| 508 | gpgkey = config.get('gpgrunner', 'key', fallback=None) |
|
| 509 | gpgpass = config.get('gpgrunner', 'pass', fallback=None) |
|
| @@ 668-685 (lines=18) @@ | ||
| 665 | :type a_dir: str |
|
| 666 | """ |
|
| 667 | if not is_windows(): |
|
| 668 | pass |
|
| 669 | else: |
|
| 670 | files = [file for file in os.listdir(a_dir) if not os.path.isdir(file)] |
|
| 671 | brokens = [] |
|
| 672 | for file in files: |
|
| 673 | if file.endswith(".exe") and file.startswith(bbconstants.PREFIXES): |
|
| 674 | print("TESTING: {0}".format((file))) |
|
| 675 | if not verify_loader_integrity(file): |
|
| 676 | brokens.append(file) |
|
| 677 | return brokens |
|
| 678 | ||
| 679 | ||
| 680 | def workers(input_data): |
|
| 681 | """ |
|
| 682 | Count number of CPU workers, smaller of number of threads and length of data. |
|
| 683 | ||
| 684 | :param input_data: Input data, some iterable. |
|
| 685 | :type input_data: list |
|
| 686 | """ |
|
| 687 | runners = len(input_data) if len(input_data) < compat.enum_cpus() else compat.enum_cpus() |
|
| 688 | return runners |
|