|
32 | 32 |
|
33 | 33 | p4merge_path = "/p4merge/p4merge.exe" |
34 | 34 |
|
| 35 | +ps_reg_path = r'"HKCU:/Software/Epic Games/Unreal Engine/Builds"' |
35 | 36 | reg_path = r"HKCU\Software\Epic Games\Unreal Engine\Builds" |
36 | 37 |
|
37 | 38 | long_path = "\\\\?\\" |
@@ -186,10 +187,10 @@ def project_version_increase(increase_type): |
186 | 187 | return False |
187 | 188 | if increase_type == "patch": |
188 | 189 | new_version = ( |
189 | | - f"{version_split[0] }.{version_split[1]}.{str(int(version_split[2]) + 1)}" |
| 190 | + f"{version_split[0]}.{version_split[1]}.{str(int(version_split[2]) + 1)}" |
190 | 191 | ) |
191 | 192 | elif increase_type == "minor": |
192 | | - new_version = f"{version_split[0] }.{str(int(version_split[1]) + 1)}.0" |
| 193 | + new_version = f"{version_split[0]}.{str(int(version_split[1]) + 1)}.0" |
193 | 194 | elif increase_type == "major": |
194 | 195 | new_version = f"{str(int(version_split[2]) + 1)}.0.0" |
195 | 196 | else: |
@@ -739,25 +740,46 @@ def generate_project_files(): |
739 | 740 | def parse_reg_query(proc): |
740 | 741 | query = proc.stdout.splitlines() |
741 | 742 | for res in query: |
742 | | - if res.startswith(" "): |
743 | | - key, rtype, value = res.split(" ")[1:] |
744 | | - yield key, rtype, value |
| 743 | + res = res.strip() |
| 744 | + if not res: |
| 745 | + continue |
| 746 | + if res.startswith("PS"): |
| 747 | + continue |
| 748 | + key, value = res.split(" : ", 1) |
| 749 | + yield key, value |
745 | 750 |
|
746 | 751 |
|
747 | 752 | def register_engine(version, path): |
748 | 753 | if os.name == "nt": |
| 754 | + path = Path(path) |
| 755 | + target_path = str(Path(path).as_posix()) |
| 756 | + registry_list = pbtools.run_with_combined_output( |
| 757 | + ["powershell", "-Command", "Get-ItemProperty", "-Path", ps_reg_path] |
| 758 | + ) |
749 | 759 | # query if this path is used elsewhere, if so, we delete it |
750 | | - for key, rtype, value in parse_reg_query( |
751 | | - pbtools.run_with_combined_output( |
752 | | - ["reg", "query", reg_path, "/f", path, "/e", "/t", "REG_SZ"] |
753 | | - ) |
754 | | - ): |
755 | | - # if we already have this version, no need to reregister it |
756 | | - if key == version: |
| 760 | + for key, value in parse_reg_query(registry_list): |
| 761 | + # if we already have this version with our target path, no need to reregister it |
| 762 | + is_target_version = key == version |
| 763 | + if is_target_version and target_path == value: |
757 | 764 | return False |
758 | | - pbtools.run(["reg", "delete", reg_path, "/v", key, "/f"]) |
| 765 | + # clear out if: |
| 766 | + # 1) if we do have a version match, but the path is different, OR |
| 767 | + # 2) if we have this path under a different version |
| 768 | + if is_target_version or path == Path(value): |
| 769 | + pbtools.run(["reg", "delete", reg_path, "/v", key, "/f"]) |
759 | 770 | pbtools.run( |
760 | | - ["reg", "add", reg_path, "/f", "/v", version, "/t", "REG_SZ", "/d", path] |
| 771 | + [ |
| 772 | + "reg", |
| 773 | + "add", |
| 774 | + reg_path, |
| 775 | + "/f", |
| 776 | + "/v", |
| 777 | + version, |
| 778 | + "/t", |
| 779 | + "REG_SZ", |
| 780 | + "/d", |
| 781 | + target_path, |
| 782 | + ] |
761 | 783 | ) |
762 | 784 | return True |
763 | 785 |
|
@@ -950,7 +972,7 @@ def download_engine(bundle_name: str, download_symbols: bool): |
950 | 972 | gcs_bucket = get_versionator_gsuri() |
951 | 973 | if not gcs_bucket: |
952 | 974 | pbtools.error_state( |
953 | | - f"Cloud storage bucket not configured. Please get support from {pbconfig.get("support_channel")}" |
| 975 | + f"Cloud storage bucket not configured. Please get support from {pbconfig.get('support_channel')}" |
954 | 976 | ) |
955 | 977 | return |
956 | 978 | # TODO: maybe cache out Saved and Intermediate folders? |
@@ -1035,10 +1057,19 @@ def change_args(args: list[str]): |
1035 | 1057 | # print out a newline |
1036 | 1058 | print("") |
1037 | 1059 |
|
| 1060 | + version_matches = ( |
| 1061 | + branch_version and get_engine_version_with_prefix() == branch_version |
| 1062 | + ) |
| 1063 | + |
1038 | 1064 | if proc.returncode: |
1039 | | - pbtools.error_state( |
1040 | | - f"Failed to download engine update. Make sure your system time is synced. If this issue persists, please request help from {pbconfig.get('support_channel')}." |
1041 | | - ) |
| 1065 | + if not version_matches: |
| 1066 | + pbtools.error_state( |
| 1067 | + f"Failed to download engine update. Make sure your system time is synced. If this issue persists, please request help from {pbconfig.get('support_channel')}." |
| 1068 | + ) |
| 1069 | + else: |
| 1070 | + pblog.error( |
| 1071 | + f"Failed to download engine update. Make sure your system time is synced. You may also be offline. If this issue persists, please request help from {pbconfig.get('support_channel')}." |
| 1072 | + ) |
1042 | 1073 | # TODO: similarly, have to copy PDBs out into a store so longtail doesn't touch the engine and delete everything but symbols |
1043 | 1074 | if download_symbols: |
1044 | 1075 | pblog.warning( |
@@ -1105,9 +1136,9 @@ def update_source_control(): |
1105 | 1136 | with ue_config( |
1106 | 1137 | "Saved/Config/Windows/SourceControlSettings.ini" |
1107 | 1138 | ) as source_control_config: |
1108 | | - source_control_config["SourceControl.SourceControlSettings"][ |
1109 | | - "Provider" |
1110 | | - ] = "Git LFS 2" |
| 1139 | + source_control_config["SourceControl.SourceControlSettings"]["Provider"] = ( |
| 1140 | + "Git LFS 2" |
| 1141 | + ) |
1111 | 1142 | git_lfs_2 = source_control_config["GitSourceControl.GitSourceControlSettings"] |
1112 | 1143 | binary_path = pbgit.get_git_executable() |
1113 | 1144 | if binary_path and binary_path != "git": |
@@ -1424,9 +1455,10 @@ def inspect_source(all=False): |
1424 | 1455 | if not zip_path.exists(): |
1425 | 1456 | pblog.info(f"Downloading Resharper {version}") |
1426 | 1457 | url = f"https://download-cdn.jetbrains.com/resharper/dotUltimate.{version}/{zip_name}" |
1427 | | - with urllib.request.urlopen(url) as response, open( |
1428 | | - str(zip_path), "wb" |
1429 | | - ) as out_file: |
| 1458 | + with ( |
| 1459 | + urllib.request.urlopen(url) as response, |
| 1460 | + open(str(zip_path), "wb") as out_file, |
| 1461 | + ): |
1430 | 1462 | shutil.copyfileobj(response, out_file) |
1431 | 1463 | resharper_dir = saved_dir / Path("ResharperCLI") |
1432 | 1464 | pblog.info(f"Unpacking Resharper {version}") |
@@ -1535,7 +1567,7 @@ def build_installed_build(): |
1535 | 1567 | # reconstruct a versioned branch name |
1536 | 1568 | major = build_version["MajorVersion"] |
1537 | 1569 | minor = build_version["MinorVersion"] |
1538 | | - branch_version = f"{major}.{minor}-{branch.split("-main")[0].upper()}" |
| 1570 | + branch_version = f"{major}.{minor}-{branch.split('-main')[0].upper()}" |
1539 | 1571 | changelist = build_version["Changelist"] + 1 |
1540 | 1572 | code_changelist = build_version["CompatibleChangelist"] + 1 |
1541 | 1573 |
|
|
0 commit comments