diff --git a/dev_scripts/find_duplicate_files_if_case_insensitive.py b/dev_scripts/find_duplicate_files_if_case_insensitive.py new file mode 100644 index 000000000..3b392e9b1 --- /dev/null +++ b/dev_scripts/find_duplicate_files_if_case_insensitive.py @@ -0,0 +1,58 @@ +""" +Find all the duplicate repository files on case-insensitive filesystems. + +This is in particular important for Windows so that we do not mess up Git there. + +You should run this script on a *case-sensitive* filesystem, *e.g.*, in Linux. +""" + +import os.path +import pathlib +import sys +import textwrap +from typing import List, MutableMapping + + +def main() -> int: + this_path = pathlib.Path(os.path.realpath(__file__)) + repo_root = this_path.parent.parent + + paths = [] # type: List[pathlib.Path] + + for path in repo_root.iterdir(): + if path.name == ".git": + continue + + if path.is_file(): + paths.append(path) + else: + assert path.is_dir() + paths.extend( + another_path + for another_path in path.glob("**/*") + if another_path.is_file() + ) + + path_map = dict() # type: MutableMapping[str, List[pathlib.Path]] + for path in paths: + key = str(path).lower() + existing_paths = path_map.get(key, None) + if existing_paths is None: + path_map[key] = [path] + else: + existing_paths.append(path) + + for key in sorted(path_map.keys()): + paths = path_map[key] + if len(paths) > 1: + paths_joined = "\n".join( + str(path.relative_to(repo_root)) for path in sorted(paths) + ) + paths_joined_indented = textwrap.indent(paths_joined, " ") + print(f"* Duplicates for {key}:\n{paths_joined_indented}") + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/test_data/XOrDefault/Blob/CategoryOrDefault.default.json b/test_data/XOrDefault/Blob/CategoryOrDefault.default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/Blob/CategoryOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/Blob/CategoryOrDefault.non-default.json b/test_data/XOrDefault/Blob/CategoryOrDefault.non-default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/Blob/CategoryOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/Extension/ValueTypeOrDefault.default.json b/test_data/XOrDefault/Extension/ValueTypeOrDefault.default.json deleted file mode 100644 index b97c19638..000000000 --- a/test_data/XOrDefault/Extension/ValueTypeOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"xs:string" \ No newline at end of file diff --git a/test_data/XOrDefault/Extension/ValueTypeOrDefault.non-default.json b/test_data/XOrDefault/Extension/ValueTypeOrDefault.non-default.json deleted file mode 100644 index c1b9b8143..000000000 --- a/test_data/XOrDefault/Extension/ValueTypeOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"xs:unsignedShort" \ No newline at end of file diff --git a/test_data/XOrDefault/File/CategoryOrDefault.default.json b/test_data/XOrDefault/File/CategoryOrDefault.default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/File/CategoryOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/File/CategoryOrDefault.non-default.json b/test_data/XOrDefault/File/CategoryOrDefault.non-default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/File/CategoryOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/MultiLanguageProperty/CategoryOrDefault.default.json b/test_data/XOrDefault/MultiLanguageProperty/CategoryOrDefault.default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/MultiLanguageProperty/CategoryOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/MultiLanguageProperty/CategoryOrDefault.non-default.json b/test_data/XOrDefault/MultiLanguageProperty/CategoryOrDefault.non-default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/MultiLanguageProperty/CategoryOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/Property/CategoryOrDefault.default.json b/test_data/XOrDefault/Property/CategoryOrDefault.default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/Property/CategoryOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/Property/CategoryOrDefault.non-default.json b/test_data/XOrDefault/Property/CategoryOrDefault.non-default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/Property/CategoryOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/Qualifier/KindOrDefault.default.json b/test_data/XOrDefault/Qualifier/KindOrDefault.default.json deleted file mode 100644 index cec6e33d5..000000000 --- a/test_data/XOrDefault/Qualifier/KindOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"ConceptQualifier" \ No newline at end of file diff --git a/test_data/XOrDefault/Qualifier/KindOrDefault.non-default.json b/test_data/XOrDefault/Qualifier/KindOrDefault.non-default.json deleted file mode 100644 index 3a463626a..000000000 --- a/test_data/XOrDefault/Qualifier/KindOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"TemplateQualifier" \ No newline at end of file diff --git a/test_data/XOrDefault/Range/CategoryOrDefault.default.json b/test_data/XOrDefault/Range/CategoryOrDefault.default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/Range/CategoryOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/Range/CategoryOrDefault.non-default.json b/test_data/XOrDefault/Range/CategoryOrDefault.non-default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/Range/CategoryOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/ReferenceElement/CategoryOrDefault.default.json b/test_data/XOrDefault/ReferenceElement/CategoryOrDefault.default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/ReferenceElement/CategoryOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/ReferenceElement/CategoryOrDefault.non-default.json b/test_data/XOrDefault/ReferenceElement/CategoryOrDefault.non-default.json deleted file mode 100644 index 1f7a096f3..000000000 --- a/test_data/XOrDefault/ReferenceElement/CategoryOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"VARIABLE" \ No newline at end of file diff --git a/test_data/XOrDefault/Submodel/KindOrDefault.default.json b/test_data/XOrDefault/Submodel/KindOrDefault.default.json deleted file mode 100644 index c03e1846d..000000000 --- a/test_data/XOrDefault/Submodel/KindOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -"Instance" \ No newline at end of file diff --git a/test_data/XOrDefault/Submodel/KindOrDefault.non-default.json b/test_data/XOrDefault/Submodel/KindOrDefault.non-default.json deleted file mode 100644 index c03e1846d..000000000 --- a/test_data/XOrDefault/Submodel/KindOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -"Instance" \ No newline at end of file diff --git a/test_data/XOrDefault/SubmodelElementList/OrderRelevantOrDefault.default.json b/test_data/XOrDefault/SubmodelElementList/OrderRelevantOrDefault.default.json deleted file mode 100644 index f32a5804e..000000000 --- a/test_data/XOrDefault/SubmodelElementList/OrderRelevantOrDefault.default.json +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/test_data/XOrDefault/SubmodelElementList/OrderRelevantOrDefault.non-default.json b/test_data/XOrDefault/SubmodelElementList/OrderRelevantOrDefault.non-default.json deleted file mode 100644 index f32a5804e..000000000 --- a/test_data/XOrDefault/SubmodelElementList/OrderRelevantOrDefault.non-default.json +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file