Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/complex/netconvert/runner.py
169678 views
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
4
# Copyright (C) 2008-2025 German Aerospace Center (DLR) and others.
5
# This program and the accompanying materials are made available under the
6
# terms of the Eclipse Public License 2.0 which is available at
7
# https://www.eclipse.org/legal/epl-2.0/
8
# This Source Code may also be made available under the following Secondary
9
# Licenses when the conditions for such availability set forth in the Eclipse
10
# Public License 2.0 are satisfied: GNU General Public License, version 2
11
# or later which is available at
12
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
13
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
14
15
# @file runner.py
16
# @author Jakob Erdmann
17
# @author Michael Behrisch
18
# @date 2013-08-16
19
20
"""
21
import sumo network then export to the given format and import again
22
and check for idempotency with the original sumo network
23
"""
24
from __future__ import absolute_import
25
26
27
import sys
28
import os
29
import subprocess
30
sys.path.append(
31
os.path.join(os.path.dirname(__file__), '..', '..', '..', "tools"))
32
import sumolib # noqa
33
34
format = sys.argv[1]
35
netconvert = sumolib.checkBinary('netconvert')
36
37
args1 = [netconvert,
38
'--sumo-net-file', 'input_net.net.xml',
39
'--%s-output' % format, format]
40
41
args2 = [netconvert, '--%s' % format, format] + sys.argv[2:]
42
if format == "matsim":
43
args2 += ["--xml-validation", "never"]
44
45
subprocess.call(args1)
46
subprocess.call(args2)
47
48