Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tools/scripts/checkDuplicateFilenames.py
blob: 0a68d5043be92c8725141d5ba3eff1136ef70cdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3

#              Copyright Catch2 Authors
# Distributed under the Boost Software License, Version 1.0.
#   (See accompanying file LICENSE.txt or copy at
#        https://www.boost.org/LICENSE_1_0.txt)

# SPDX-License-Identifier: BSL-1.0

"""Checks that no two source files of the library share a file name.

Build tools that keep object files in one directory, such as Visual Studio
projects, would otherwise compile one over the other. Headers may share
names: they are always included with their directory.
"""

import os
import sys

files_set = set()

for root, dir, files in os.walk("src/Progmasoft"):
    for file in files:
        if not file.endswith('.cpp'):
            continue
        if file not in files_set:
            files_set.add(file)
        else:
            print("File %s is duplicate" % file)
            sys.exit(1)