def __init__(self, myPath, otherPath, debug=False): super(cDiff, self).__init__(myPath, False) self._otherPathObj=None self._linkAppend="" self._debug=debug if self._pathName: #self._subFiles=self.getSubFiles() self._otherPathObj=cPath(otherPath) if self._otherPathObj: self._otherPathName=self._otherPathObj.getPath() if not self._otherPathName: self._otherPathObj=None else: self._findLinkAppend()
oPath=self._otherPathObj.getPath() nSubPath=re.sub(r'^/', "", subPath) totalSize=0 for ff in glob.glob(self._pathName+subPath+'/*.so*'): if os.path.islink(ff): continue if os.path.isdir(ff): continue fsize=os.path.getsize(ff) if fsize < 4000: continue base=os.path.basename(ff) if os.path.exists(oPath+subPath+'/'+base): totalSize += fsize print 'ln -s '+self._linkAppend+nSubPath+'/'+base, print ' size= '+str(fsize) print 'Total size = '+str(totalSize) #Return path object of the other path def getOtherObj(self): return self._otherPathObj # main # if __name__ == '__main__': dir1=cPath("~/work/aphsdk/targetNFS") dir2=cPath("~/work/aphsdk/linux-devkit/sysroots/cortexa15hf-neon-linux-gnueabi") chkPath=("/usr/lib", "/lib") if not dir1.getPath() or not dir2.getPath(): print "Invalid path ... program exits" system.exit(1) obj=cDiff(dir1.getPath(), dir2.getPath()) obj._findSo3()