From 3ac092cf721010f6f457e268dcbf5be83bfab243 Mon Sep 17 00:00:00 2001 From: Yang Gang Date: Thu, 19 Dec 2024 14:01:12 +0800 Subject: BaseTools: Clean up os.path.normcase and os.path.normpath usage Refer to the docs of python, `os.path.normcase(path)` function: "Normalize the case of a pathname. On Windows, convert all characters in the pathname to lowercase, and also convert forward slashes to backward slashes. On other operating systems, return the path unchanged." `os.path.normpath(path)` also convert forward slashes to backward slashes. So call `os.path.normcase` after `os.path.normpath` just convert path to lowercase on Windows(only). And Windows is case-insensitive but case-preserving. So the usage of `os.path.normcase(os.path.normpath(path))` can be simplified to `os.path.normpath(path)`. Then we can use case-preserving paths rather than lowercase paths in compile_commands.json file or build log. But this patch continue to use `os.path.normcase` when comparing/searching paths. Signed-off-by: Yang Gang --- BaseTools/Source/Python/Common/TargetTxtClassObject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'BaseTools/Source/Python/Common/TargetTxtClassObject.py') diff --git a/BaseTools/Source/Python/Common/TargetTxtClassObject.py b/BaseTools/Source/Python/Common/TargetTxtClassObject.py index 363c38302b..e741d0399c 100644 --- a/BaseTools/Source/Python/Common/TargetTxtClassObject.py +++ b/BaseTools/Source/Python/Common/TargetTxtClassObject.py @@ -176,7 +176,7 @@ class TargetTxtDict(): ConfDirectoryPath = mws.join(os.environ["WORKSPACE"], ConfDirectoryPath) else: if "CONF_PATH" in os.environ: - ConfDirectoryPath = os.path.normcase(os.path.normpath(os.environ["CONF_PATH"])) + ConfDirectoryPath = os.path.normpath(os.environ["CONF_PATH"]) else: # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf ConfDirectoryPath = mws.join(os.environ["WORKSPACE"], 'Conf') -- cgit v1.2.3