From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com []) by mx.groups.io with SMTP id smtpd.web10.3649.1588365590739524866 for ; Fri, 01 May 2020 13:39:51 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: oeiETYYDc2NOM9Ih15u0OGsnc1xCSbqsPu+9CjobqQQpgrepNHS6HL/bBZEFXE5yz5JmGTNHxo SBjnxy+gKVgA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 13:39:50 -0700 IronPort-SDR: 96GeDSXB9aBRqHQpYKyO7DY+kuzCXxG1J5OgEWguxZao/4SWvUqiWyVSz44rCTweXx0VGKmWV1 ph3Jr2IN8ksA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,341,1583222400"; d="scan'208";a="460372442" Received: from aedesimo-desk.amr.corp.intel.com ([10.212.28.52]) by fmsmga006.fm.intel.com with ESMTP; 01 May 2020 13:39:49 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH 2/2] EdkRepo: Remove duplicate definitions of case_insensitive_single_match and case_insensitive_equal Date: Fri, 1 May 2020 13:39:46 -0700 Message-Id: <20200501203946.17620-3-ashley.e.desimone@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200501203946.17620-1-ashley.e.desimone@intel.com> References: <20200501203946.17620-1-ashley.e.desimone@intel.com> Remove duplicate definitions of and update imports of case_insensitive_single_match and case_insensitive_equal to point to the definitions in workspace_maintenance.py Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- edkrepo/commands/clone_command.py | 3 ++- edkrepo/common/common_repo_functions.py | 14 +------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/edkrepo/commands/clone_command.py b/edkrepo/commands/clone_command.py index 701a853..cd65fe6 100644 --- a/edkrepo/commands/clone_command.py +++ b/edkrepo/commands/clone_command.py @@ -14,12 +14,13 @@ from edkrepo.commands.edkrepo_command import EdkrepoCommand from edkrepo.commands.edkrepo_command import SubmoduleSkipArgument import edkrepo.commands.arguments.clone_args as arguments from edkrepo.common.common_repo_functions import pull_latest_manifest_repo, clone_repos, sparse_checkout, verify_manifest_data -from edkrepo.common.common_repo_functions import case_insensitive_single_match, update_editor_config +from edkrepo.common.common_repo_functions import update_editor_config from edkrepo.common.common_repo_functions import write_included_config, write_conditional_include from edkrepo.common.common_repo_functions import find_project_in_index, combinations_in_manifest from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException, EdkrepoManifestInvalidException from edkrepo.common.humble import CLONE_INVALID_WORKSPACE, CLONE_INVALID_PROJECT_ARG, CLONE_INVALID_COMBO_ARG from edkrepo.common.humble import SPARSE_CHECKOUT, CLONE_INVALID_LOCAL_ROOTS +from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py index a333489..485aa26 100644 --- a/edkrepo/common/common_repo_functions.py +++ b/edkrepo/common/common_repo_functions.py @@ -60,6 +60,7 @@ from edkrepo.common.edkrepo_exception import EdkrepoNotFoundException, EdkrepoGi from edkrepo.common.edkrepo_exception import EdkrepoFoundMultipleException, EdkrepoHookNotFoundException from edkrepo.common.edkrepo_exception import EdkrepoGitConfigSetupException, EdkrepoManifestInvalidException from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_single_manifest_repo +from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match from edkrepo.common.ui_functions import init_color_console from edkrepo_manifest_parser import edk_manifest from edkrepo_manifest_parser.edk_manifest_validation import validate_manifestrepo @@ -571,19 +572,6 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None): print(SPARSE_CHECKOUT) sparse_checkout(workspace_path, current_repos, manifest) - -def case_insensitive_equal(str1, str2): - return unicodedata.normalize("NFKD", str1.casefold()) == unicodedata.normalize("NFKD", str2.casefold()) - - -def case_insensitive_single_match(str1, str_list): - matches = [x for x in str_list if case_insensitive_equal(str1, x)] - if len(matches) == 0: - raise EdkrepoNotFoundException(GEN_A_NOT_IN_B.format(str1, str_list)) - elif len(matches) > 1: - raise EdkrepoFoundMultipleException(GEN_FOUND_MULT_A_IN_B.format(str1, str_list)) - return matches[0] - def get_latest_sha(repo, branch, remote_or_url='origin'): try: (latest_sha, ref) = repo.git.ls_remote(remote_or_url, 'refs/heads/{}'.format(branch)).split() -- 2.16.2.windows.1