Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/updateTestsuiteFiles.py
428236 views
1
#!/usr/bin/env python
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2009-2026 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 updateTestsuiteFiles.py
15
# @author Pablo Alvarez Lopez
16
# @date 2025-12-10
17
18
"""
19
"""
20
import os
21
22
23
def update_testsuite_files():
24
# Target filenames to look for
25
target_files = [
26
"testsuite.netedit.external",
27
"testsuite.netedit.internal",
28
"testsuite.netedit.output"
29
]
30
31
# Get the directory where the script is located
32
base_dir = os.path.dirname(os.path.abspath(__file__))
33
34
print(f"Starting scan in: {base_dir}")
35
36
# Walk through the directory tree
37
for root, dirs, files in os.walk(base_dir):
38
# Check if any of the target files exist in the current directory
39
for filename in target_files:
40
if filename in files:
41
file_path = os.path.join(root, filename)
42
43
# Get list of subdirectories in the current folder (root)
44
# We filter 'dirs' provided by os.walk for the current depth
45
# Note: 'dirs' list in os.walk is modifiable in-place to prune search,
46
# but here we just read it.
47
48
# Let's ensure we get a clean list of immediate subfolders
49
subfolders = [
50
d for d in os.listdir(root)
51
if os.path.isdir(os.path.join(root, d)) and not d.startswith('.')
52
]
53
subfolders.sort()
54
55
print(f"Updating {filename} in {root}")
56
57
try:
58
with open(file_path, 'w') as f:
59
for folder in subfolders:
60
f.write(f"{folder}\n")
61
except IOError as e:
62
print(f"Error writing to {file_path}: {e}")
63
64
65
if __name__ == "__main__":
66
update_testsuite_files()
67
68