#!/usr/bin/env python1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2019-2025 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 runner.py14# @author Michael Behrisch15# @date 2019-05-011617from __future__ import absolute_import18from __future__ import print_function192021import os22import subprocess23import sys24import time25if "SUMO_HOME" in os.environ:26sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools"))27from sumolib import checkBinary # noqa2829javac = "javac"30java = "java"31if 'JAVA_HOME' in os.environ:32javac = os.path.join(os.environ['JAVA_HOME'], "bin", javac)33java = os.path.join(os.environ['JAVA_HOME'], "bin", java)3435traasJar = os.path.join(os.environ['SUMO_HOME'], "bin", "TraaS.jar")36assert os.path.exists(traasJar)3738for f in sys.argv[1:]:39subprocess.check_call([javac, "-cp", traasJar, "-Xlint:unchecked", "data/%s.java" % f])40procs = [subprocess.Popen([java, "-cp", os.pathsep.join([traasJar, "data"]), sys.argv[1],41checkBinary('sumo'), "data/config.sumocfg"])]42if len(sys.argv) > 2:43time.sleep(10) # give sumo some time to start44procs += [subprocess.Popen([java, "-cp", os.pathsep.join([traasJar, "data"]), f]) for f in sys.argv[2:]]45for p in procs:46p.wait()474849