compare_xacro.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2014 Aldebaran Robotics
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 
18 # This file takes two folders and compares the .xacro files in there
19 # it orders the XML to have proper XML comparisons (it deals with elements
20 # out of order basically)
21 
22 from __future__ import print_function
23 import argparse
24 import os
25 from xmldiff.xmldiff import compareFiles
26 
27 if __name__ == '__main__':
28  parser = argparse.ArgumentParser(
29  description='Compares all the .xacro in two folders.')
30  parser.add_argument('folder1')
31  parser.add_argument('folder2')
32  args = parser.parse_args()
33  files1 = set([i for i in os.listdir(args.folder1)
34  if i.endswith('.xacro')])
35  files2 = set([i for i in os.listdir(args.folder2)
36  if i.endswith('.xacro')])
37  for i in files1.intersection(files2):
38  diff = compareFiles(os.path.join(args.folder1, i),
39  os.path.join(args.folder2, i))
40  if diff:
41  print('---------------------------------------------------------')
42  print('File %s in common' % i)
43  print('---------------------------------------------------------')
44  print(diff)
def compareFiles(filename1, filename2)
Definition: xmldiff.py:135


naoqi_tools
Author(s): Mikael Arguedas
autogenerated on Thu Jul 16 2020 03:18:36