Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/texttestDiff.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 texttestDiff.py
15
# @author Jakob Erdmann
16
# @date 2015-11-03
17
18
"""
19
This is meant to be used as a diff tool for the sumo public and internal tests by adding the line
20
----------------------------
21
diff_program:texttestDiff.py
22
----------------------------
23
in ~/.texttest/config
24
25
It runs the textual diff tool (vim by default) and, if the differing files are
26
sumo networks, opens both of them with sumo-gui.
27
"""
28
import os
29
import sys
30
import subprocess
31
32
if len(sys.argv) == 4:
33
basedir, new = sys.argv[2:]
34
orig = os.path.join(basedir, new)
35
os.environ["GUISIM_BINARY"] = "sumo-gui"
36
else:
37
orig, new = sys.argv[1:]
38
39
40
subprocess.Popen(["tkdiff", orig, new])
41
42
if ("net.netgen" in orig or
43
"net.netconvert" in orig or
44
"net.scenario" in orig or
45
"net2.scenario" in orig or
46
"net.complex" in orig or
47
"net.tools" in orig or
48
"osmimport.tools" in orig or
49
".net.xml" in orig):
50
sumo = os.environ["GUISIM_BINARY"]
51
extraArgs = []
52
# extraArgs += ["--gui-settings-file", "/scr2/debug/000_view_settings/internal_junctions.xml"]
53
# extraArgs += ["--gui-settings-file", "/scr2/debug/000_view_settings/junctions.xml"]
54
# extraArgs += ["--gui-settings-file", "/scr2/debug/000_view_settings/junctionType.xml"]
55
subprocess.Popen([sumo, "-n", orig, "-e", "3600"] + extraArgs)
56
subprocess.Popen([sumo, "-n", new, "-e", "3600"] + extraArgs)
57
58