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(
00029         description='Compares all the .xacro in two folders.')
00030     parser.add_argument('folder1')
00031     parser.add_argument('folder2')
00032     args = parser.parse_args()
00033     files1 = set([i for i in os.listdir(args.folder1)
00034                  if i.endswith('.xacro')])
00035     files2 = set([i for i in os.listdir(args.folder2)
00036                  if i.endswith('.xacro')])
00037     for i in files1.intersection(files2):
00038         diff = compareFiles(os.path.join(args.folder1, i),
00039                             os.path.join(args.folder2, i))
00040         if diff:
00041             print('---------------------------------------------------------')
00042             print('File %s in common' % i)
00043             print('---------------------------------------------------------')
00044             print(diff)


naoqi_tools
Author(s): Mikael Arguedas
autogenerated on Wed Aug 16 2017 02:28:16