#!/usr/bin/env python1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2009-2026 German Aerospace Center (DLR) and others.3# This program and the accompanying materials are made available under the4# terms of the Eclipse Public License 2.0 which is available at5# https://www.eclipse.org/legal/epl-2.0/6# This Source Code may also be made available under the following Secondary7# Licenses when the conditions for such availability set forth in the Eclipse8# Public License 2.0 are satisfied: GNU General Public License, version 29# or later which is available at10# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later1213# @file updateTestsuiteFiles.py14# @author Pablo Alvarez Lopez15# @date 2025-12-101617"""18"""19import os202122def update_testsuite_files():23# Target filenames to look for24target_files = [25"testsuite.netedit.external",26"testsuite.netedit.internal",27"testsuite.netedit.output"28]2930# Get the directory where the script is located31base_dir = os.path.dirname(os.path.abspath(__file__))3233print(f"Starting scan in: {base_dir}")3435# Walk through the directory tree36for root, dirs, files in os.walk(base_dir):37# Check if any of the target files exist in the current directory38for filename in target_files:39if filename in files:40file_path = os.path.join(root, filename)4142# Get list of subdirectories in the current folder (root)43# We filter 'dirs' provided by os.walk for the current depth44# Note: 'dirs' list in os.walk is modifiable in-place to prune search,45# but here we just read it.4647# Let's ensure we get a clean list of immediate subfolders48subfolders = [49d for d in os.listdir(root)50if os.path.isdir(os.path.join(root, d)) and not d.startswith('.')51]52subfolders.sort()5354print(f"Updating {filename} in {root}")5556try:57with open(file_path, 'w') as f:58for folder in subfolders:59f.write(f"{folder}\n")60except IOError as e:61print(f"Error writing to {file_path}: {e}")626364if __name__ == "__main__":65update_testsuite_files()666768