blob: b9cb483f230ab07f09560949170152c0ddbfcd02 (
plain)
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
|
#!/usr/bin/env python
import os
import sys
import lxml.etree
import Bcfg2.Options
def main():
parser = Bcfg2.Options.get_parser("Tool to remove bundle names")
parser.add_options([Bcfg2.Options.Common.repository])
parser.parse()
bundler_dir = os.path.join(Bcfg2.Options.setup.repository, "Bundler")
if os.path.exists(bundler_dir):
for root, _, files in os.walk(bundler_dir):
for fname in files:
bpath = os.path.join(root, fname)
newpath = bpath
if newpath.endswith(".genshi"):
newpath = newpath[:-6] + "xml"
print("Converting %s to %s" % (bpath, newpath))
else:
print("Converting %s" % bpath)
xroot = lxml.etree.parse(bpath)
xdata = xroot.getroot()
if 'name' in xdata.attrib:
del xdata.attrib['name']
xroot.write(bpath)
if __name__ == '__main__':
sys.exit(main())
|