From 981266646c895dd5a41d31833493f11dd9855a40 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 24 Apr 2023 18:24:35 +0300 Subject: [PATCH] Force drive letter to lower case when calculating project checksum on Windows // Resolve #4600 --- platformio/project/helpers.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platformio/project/helpers.py b/platformio/project/helpers.py index 9dbd499c..aec12dd9 100644 --- a/platformio/project/helpers.py +++ b/platformio/project/helpers.py @@ -13,6 +13,7 @@ # limitations under the License. import os +import re import subprocess from hashlib import sha1 @@ -94,7 +95,16 @@ def compute_project_checksum(config): checksum = sha1(hashlib_encode_data(__version__)) # configuration file state - checksum.update(hashlib_encode_data(config.to_json())) + config_data = config.to_json() + if IS_WINDOWS: + # issue #4600: fix drive letter + config_data = re.sub( + r"([A-Z]):\\", + lambda match: "%s:\\" % match.group(1).lower(), + config_data, + flags=re.I, + ) + checksum.update(hashlib_encode_data(config_data)) # project file structure check_suffixes = (".c", ".cc", ".cpp", ".h", ".hpp", ".s", ".S")