compare_xacro.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 # Copyright (C) 2014 Aldebaran Robotics
00004 #
00005 # Licensed under the Apache License, Version 2.0 (the "License");
00006 # you may not use this file except in compliance with the License.
00007 # You may obtain a copy of the License at
00008 #
00009 # http://www.apache.org/licenses/LICENSE-2.0
00010 #
00011 # Unless required by applicable law or agreed to in writing, software
00012 # distributed under the License is distributed on an "AS IS" BASIS,
00013 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 # See the License for the specific language governing permissions and
00015 # limitations under the License.
00016 #
00017 
00018 # This file takes two folders and compares the .xacro files in there
00019 # it orders the XML to have proper XML comparisons (it deals with elements
00020 # out of order basically)
00021 
00022 from __future__ import print_function
00023 import argparse
00024 import os
00025 from xmldiff.xmldiff import compareFiles
00026 
00027 if __name__ == '__main__':
00028     parser = argparse.ArgumentParser(description='Compares all the .xacro in two folders.')
00029     parser.add_argument('folder1')
00030     parser.add_argument('folder2')
00031     args = parser.parse_args()
00032     files1 = set([ i for i in os.listdir(args.folder1) if i.endswith('.xacro')])
00033     files2 = set([ i for i in os.listdir(args.folder2) if i.endswith('.xacro')])
00034     for i in files1.intersection(files2):
00035         diff = compareFiles(os.path.join(args.folder1, i), os.path.join(args.folder2, i))
00036         if diff:
00037             print('---------------------------------------------------------')
00038             print('File %s in common' % i)
00039             print('---------------------------------------------------------')
00040             print(diff)


naoqi_tools
Author(s): Mikael Arguedas
autogenerated on Thu Aug 27 2015 14:05:48