(files, ns)
| 446 | |
| 447 | |
| 448 | def copy_files(files, ns): |
| 449 | if ns.copy: |
| 450 | ns.copy.mkdir(parents=True, exist_ok=True) |
| 451 | |
| 452 | try: |
| 453 | total = len(files) |
| 454 | except TypeError: |
| 455 | total = None |
| 456 | count = 0 |
| 457 | |
| 458 | zip_file = _create_zip_file(ns) |
| 459 | try: |
| 460 | need_compile = [] |
| 461 | in_catalog = [] |
| 462 | |
| 463 | for dest, src in files: |
| 464 | count += 1 |
| 465 | if count % 10 == 0: |
| 466 | if total: |
| 467 | log_info("Processed {:>4} of {} files", count, total) |
| 468 | else: |
| 469 | log_info("Processed {} files", count) |
| 470 | log_debug("Processing {!s}", src) |
| 471 | |
| 472 | if isinstance(src, tuple): |
| 473 | src, content = src |
| 474 | if ns.copy: |
| 475 | log_debug("Copy {} -> {}", src, ns.copy / dest) |
| 476 | (ns.copy / dest).parent.mkdir(parents=True, exist_ok=True) |
| 477 | with open(ns.copy / dest, "wb") as f: |
| 478 | f.write(content) |
| 479 | if ns.zip: |
| 480 | log_debug("Zip {} into {}", src, ns.zip) |
| 481 | zip_file.writestr(str(dest), content) |
| 482 | continue |
| 483 | |
| 484 | if ( |
| 485 | ns.precompile |
| 486 | and src in PY_FILES |
| 487 | and src not in EXCLUDE_FROM_COMPILE |
| 488 | and src.parent not in DATA_DIRS |
| 489 | and os.path.normcase(str(dest)).startswith(os.path.normcase("Lib")) |
| 490 | ): |
| 491 | if ns.copy: |
| 492 | need_compile.append((dest, ns.copy / dest)) |
| 493 | else: |
| 494 | (ns.temp / "Lib" / dest).parent.mkdir(parents=True, exist_ok=True) |
| 495 | copy_if_modified(src, ns.temp / "Lib" / dest) |
| 496 | need_compile.append((dest, ns.temp / "Lib" / dest)) |
| 497 | |
| 498 | if src not in EXCLUDE_FROM_CATALOG: |
| 499 | in_catalog.append((src.name, src)) |
| 500 | |
| 501 | if ns.copy: |
| 502 | log_debug("Copy {} -> {}", src, ns.copy / dest) |
| 503 | (ns.copy / dest).parent.mkdir(parents=True, exist_ok=True) |
| 504 | try: |
| 505 | copy_if_modified(src, ns.copy / dest) |
no test coverage detected
searching dependent graphs…