Skip to content

Commit 6a88e42

Browse files
committed
Convert remaining prints to logs
1 parent 4b5469b commit 6a88e42

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

UDKTests/run_udk_tests.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def poke_file(file: Path, event: threading.Event):
289289

290290

291291
def move_file(src: Path, dst: Path):
292-
logger.info("{} -> {}", src, dst)
292+
logger.info("'{}' -> '{}'", src, dst)
293293
shutil.move(src, dst)
294294

295295

@@ -499,11 +499,11 @@ async def main():
499499
if not udk_lite_root.is_absolute():
500500
udk_lite_root = (SCRIPT_DIR / udk_lite_root).resolve()
501501

502-
print(f"UDK_LITE_TAG={udk_lite_tag}")
503-
print(f"UDK_LITE_ROOT={udk_lite_root}")
504-
print(f"UDK_LITE_RELEASE_URL={udk_lite_release_url}")
505-
print(f"FCRYPTO_CLASSES_FILES={fcrypto_classes_files}")
506-
print(f"FCRYPTO_NUM_TEST_LOOPS={fcrypto_num_test_loops}")
502+
logger.info("UDK_LITE_TAG={}", udk_lite_tag)
503+
logger.info("UDK_LITE_ROOT={}", udk_lite_root)
504+
logger.info("UDK_LITE_RELEASE_URL={}", udk_lite_release_url)
505+
logger.info("FCRYPTO_CLASSES_FILES={}", fcrypto_classes_files)
506+
logger.info("FCRYPTO_NUM_TEST_LOOPS={}", fcrypto_num_test_loops)
507507

508508
input_uscript_files = [
509509
resolve_script_path(path) for path in
@@ -520,16 +520,18 @@ async def main():
520520
pkg_file = CACHE_DIR / Path(udk_lite_release_url).name
521521

522522
if cache.udk_lite_tag != udk_lite_tag:
523-
print(f"cached UDK-Lite tag '{cache.udk_lite_tag}' does not match '{udk_lite_tag}'")
523+
logger.info("cached UDK-Lite tag '{}' does not match '{}'",
524+
cache.udk_lite_tag, udk_lite_tag)
524525
dl_pkg_archive = True
525526

526527
pkg_file_outdated = cache.pkg_archive != str(pkg_file)
527528
if pkg_file_outdated:
528529
dl_pkg_archive = True
529-
print(f"cached archive '{cache.pkg_archive}' does not match '{pkg_file}'")
530+
logger.info("cached archive '{}' does not match '{}'",
531+
cache.pkg_archive, pkg_file)
530532

531533
if not pkg_file.exists():
532-
print(f"'{pkg_file}' does not exist")
534+
logger.info("'{}' does not exist", pkg_file)
533535
dl_pkg_archive = True
534536

535537
if dl_pkg_archive:
@@ -538,14 +540,14 @@ async def main():
538540
remove_old_extracted(cache)
539541
cache.pkg_archive_extracted_files = []
540542
else:
541-
print(f"using cached archive: '{pkg_file}'")
543+
logger.info("using cached archive: '{}'", pkg_file)
542544

543545
# TODO: make a cache that updates itself automatically
544546
# when fields are assigned. Just use diskcache?
545547
cache.pkg_archive = str(pkg_file)
546548
write_cache(cache_file, cache)
547549

548-
print(f"extracting '{pkg_file}'...")
550+
logger.info("extracting '{}'...", pkg_file)
549551
with py7zr.SevenZipFile(pkg_file) as pkg:
550552
filenames = pkg.getnames()
551553
targets = [
@@ -572,7 +574,7 @@ async def main():
572574
Path(od).mkdir(parents=True, exist_ok=True)
573575

574576
if targets:
575-
print(f"extracting {len(targets)} targets to '{udk_lite_root}'")
577+
logger.info("extracting {} targets to '{}'", len(targets), udk_lite_root)
576578
pkg.extract(udk_lite_root, targets)
577579

578580
cache.pkg_archive_extracted_files += out_files + out_dirs
@@ -583,7 +585,7 @@ async def main():
583585
dst_dir = udk_lite_root / "Development/Src/FCrypto/Classes/"
584586
dst_dir.mkdir(parents=True, exist_ok=True)
585587
dst = dst_dir / script_file.name
586-
print(f"'{script_file}' -> '{dst}'")
588+
logger.info("'{}' -> '{}'", script_file, dst)
587589
shutil.copy(script_file, dst)
588590

589591
log_dir = udk_lite_root / "UDKGame/Logs/"
@@ -603,7 +605,7 @@ async def main():
603605
watcher = LogWatcher(BUILDING_EVENT, TESTING_EVENT, log_file)
604606

605607
if not log_file.exists():
606-
print(f"'{log_file}' does not exist yet, touching...")
608+
logger.info("'{}' does not exist yet, touching...", log_file)
607609
log_file.parent.mkdir(parents=True, exist_ok=True)
608610
log_file.touch()
609611

@@ -636,7 +638,7 @@ async def main():
636638
cfg.write(f, space_around_delimiters=False)
637639

638640
if add_fw_rules:
639-
print("adding firewall rules for UDK.exe")
641+
logger.info("adding firewall rules for UDK.exe")
640642
await (await asyncio.create_subprocess_exec(
641643
*["powershell.exe", str(UDK_FW_SCRIPT_PATH)]
642644
)).wait()
@@ -678,16 +680,15 @@ async def main():
678680

679681
udk_print_spam_thread.join(timeout=5)
680682

681-
print(f"finished with {len(watcher.warnings)} warnings")
682-
print(f"finished with {len(watcher.errors)} errors")
683+
logger.info("finished with {} warnings", len(watcher.warnings))
684+
logger.info("finished with {} errors", len(watcher.errors))
683685

684-
print("WARNINGS:")
686+
logger.info("WARNINGS:")
685687
for warn in watcher.warnings:
686-
print(warn.strip())
688+
logger.warning(warn.strip())
687689

688-
print("ERRORS:")
689690
for err in watcher.errors:
690-
print(err.strip())
691+
logger.error(err.strip())
691692

692693
if watcher.errors:
693694
raise RuntimeError("failed, errors detected")

0 commit comments

Comments
 (0)