From 54057d13d0704f710852a73dee2743c7bec58ad4 Mon Sep 17 00:00:00 2001 From: Nathaniel Haller Date: Tue, 18 Jun 2024 19:47:18 -0700 Subject: [PATCH] SyntaxWarning on three regex expressions. To resolve "SyntaxWarning: invalid escape sequence '\('" with Python 3.12.4. https://github.com/tianocore/edk2-edkrepo/issues/251 Signed-off-by: Nathaniel Haller --- edkrepo/commands/sync_command.py | 2 +- .../common/workspace_maintenance/git_config_maintenance.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/edkrepo/commands/sync_command.py b/edkrepo/commands/sync_command.py index 32c1df7..d9b4664 100644 --- a/edkrepo/commands/sync_command.py +++ b/edkrepo/commands/sync_command.py @@ -514,7 +514,7 @@ def __check_submodule_config(self, workspace_path, manifest, repo_sources): try: local_manifest_dir = os.path.join(workspace_path, "repo") prefix_required = find_git_version() >= GitVersion('2.34.0') - includeif_regex = re.compile('^includeIf "gitdir:{}(/.+)/"$'.format('%\(prefix\)' if prefix_required else '')) + includeif_regex = re.compile('^includeIf "gitdir:{}(/.+)/"$'.format('%\\(prefix\\)' if prefix_required else '')) rewrite_everything = False #Generate list of .gitconfig files that should be present in the workspace included_configs = [] diff --git a/edkrepo/common/workspace_maintenance/git_config_maintenance.py b/edkrepo/common/workspace_maintenance/git_config_maintenance.py index b993e38..cee3414 100644 --- a/edkrepo/common/workspace_maintenance/git_config_maintenance.py +++ b/edkrepo/common/workspace_maintenance/git_config_maintenance.py @@ -22,10 +22,10 @@ def clean_git_globalconfig(): prefix_required = find_git_version() >= GitVersion('2.34.0') with git.GitConfigParser(global_gitconfig_path, read_only=False) as git_globalconfig: if prefix_required: - includeif_regex = re.compile('^includeIf "gitdir:%\(prefix\)(/.+)/"$') + includeif_regex = re.compile('^includeIf "gitdir:%\\(prefix\\)(/.+)/"$') includeif_regex_old = re.compile('^includeIf "gitdir:(/.+)/"$') else: - includeif_regex_old = re.compile('^includeIf "gitdir:%\(prefix\)(/.+)/"$') + includeif_regex_old = re.compile('^includeIf "gitdir:%\\(prefix\\)(/.+)/"$') includeif_regex = re.compile('^includeIf "gitdir:(/.+)/"$') for section in git_globalconfig.sections(): data = includeif_regex.match(section)