Force drive letter to lower case when calculating project checksum on Windows // Resolve #4600

This commit is contained in:
Ivan Kravets
2023-04-24 18:24:35 +03:00
parent 0acf968b2d
commit 981266646c

View File

@@ -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")