/usr/share/sumo/tools/traci/traciToHex.py is in sumo-tools 0.15.0~dfsg-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/usr/bin/env python
# Converts all testclient.prog to hex
# $Id: traciToHex.py 9875 2011-03-06 22:35:19Z behrisch $
import os, sys
mRoot = "."
if len(sys.argv)>1:
mRoot = sys.argv[1]
for root, dirs, files in os.walk(mRoot):
if ".svn" in dirs:
dirs.remove(".svn")
for file in files:
if file == "testclient.prog":
full = os.path.join(root, file)
out = open(full + ".hex", 'w')
change = False
for line in open(full):
l = line.split()
if l and l[0] in ["setvalue", "getvalue", "getvariable", "getvariable_plus"]:
if not l[1][:2] == "0x":
l[1] = "0x%x" % int(l[1])
change = True
if not l[2][:2] == "0x":
l[2] = "0x%x" % int(l[2])
change = True
print >> out, " ".join(l)
out.close()
if change:
if os.name != "posix":
os.remove(full)
os.rename(out.name, full)
else:
os.remove(out.name)
|