Change-Id: I2b4577c972c884af08d59d7815017806928efa69 Former-commit-id:b15013e959
[formerly0654b75fb2
] [formerlycd72d75216
] [formerlyb15013e959
[formerly0654b75fb2
] [formerlycd72d75216
] [formerlyd3728fc462
[formerlycd72d75216
[formerly bb204013345db535d7cf9ca103cb033cf2507def]]]] Former-commit-id:d3728fc462
Former-commit-id:1ab4a42d95
[formerly5f8529b844
] [formerly b22462ab20225076b497bb464786b9627fdef214 [formerly0fddd4e268
]] Former-commit-id: bec327cf37c15f28952054acf0a9d8601701518e [formerlyae4107adac
] Former-commit-id:54ba19d631
31 lines
No EOL
1.2 KiB
Python
31 lines
No EOL
1.2 KiB
Python
#!/usr/bin/env python
|
|
# This script will update any saved displays or procedures with the old Topo file name
|
|
#
|
|
# This update only needs to be run if there are saved displays being stored
|
|
# outside of localization, for procedures saved in localization,
|
|
# updateTopoFile.sh will automatically call this.
|
|
|
|
|
|
import sys
|
|
import xml.etree.ElementTree as ET
|
|
|
|
xsitype = '{http://www.w3.org/2001/XMLSchema-instance}type'
|
|
|
|
def upgradeBundle(bundleFile):
|
|
tree = ET.parse(bundleFile)
|
|
root = tree.getroot()
|
|
iterpath = 'bundles/bundle/displayList/displays'
|
|
if root.tag == 'bundle':
|
|
iterpath = 'displayList/displays'
|
|
for display in root.iterfind(iterpath):
|
|
if display.get(xsitype) == "d2DMapRenderableDisplay":
|
|
for resourceData in display.iterfind('descriptor/resource/resourceData'):
|
|
if resourceData.get(xsitype) == 'topoResourceData':
|
|
for topoFile in resourceData.iterfind('topoFile'):
|
|
if topoFile.text == 'srtm30.hdf':
|
|
topoFile.text = 'defaultTopo.h5'
|
|
tree.write(bundleFile)
|
|
|
|
if __name__ == '__main__':
|
|
for arg in sys.argv[1:]:
|
|
upgradeBundle(arg) |