Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/netedit/buildTextTest.py
185785 views
1
#!/usr/bin/env python
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2025-2025 German Aerospace Center (DLR) and others.
4
# This program and the accompanying materials are made available under the
5
# terms of the Eclipse Public License 2.0 which is available at
6
# https://www.eclipse.org/legal/epl-2.0/
7
# This Source Code may also be made available under the following Secondary
8
# Licenses when the conditions for such availability set forth in the Eclipse
9
# Public License 2.0 are satisfied: GNU General Public License, version 2
10
# or later which is available at
11
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14
# @file buildTextTest.py
15
# @author Pablo Alvarez Lopez
16
# @date 2025-12-05
17
18
import os
19
20
21
def update_testsuite_files():
22
# Target filenames to look for
23
target_files = [
24
"testsuite.netedit.external",
25
"testsuite.netedit.internal",
26
"testsuite.neteditoutput"
27
]
28
29
# Get the directory where the script is located
30
base_dir = os.path.dirname(os.path.abspath(__file__))
31
32
print(f"Starting scan in: {base_dir}")
33
34
# Walk through the directory tree
35
for root, dirs, files in os.walk(base_dir):
36
# Check if any of the target files exist in the current directory
37
for filename in target_files:
38
if filename in files:
39
file_path = os.path.join(root, filename)
40
41
# Get list of subdirectories in the current folder (root)
42
subfolders = [
43
d for d in os.listdir(root)
44
if os.path.isdir(os.path.join(root, d)) and not d.startswith('.')
45
]
46
subfolders.sort()
47
48
print(f"Updating {filename} in {root}")
49
50
try:
51
with open(file_path, 'w') as f:
52
for folder in subfolders:
53
# Added extra newline \n for the empty line between entries
54
f.write(f"{folder}\n\n")
55
except IOError as e:
56
print(f"Error writing to {file_path}: {e}")
57
58
59
if __name__ == "__main__":
60
update_testsuite_files()
61
62