# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
pathname = os.path.join(rootpath, f)
try:
mode = os.stat(pathname)[ST_MODE]
- except OSError, e:
+ except OSError as e:
# It probably means that the file is a broken inode
mode = -1
if S_ISDIR(mode):
callback(pathname, **kwargs)
else:
# Unknown file type, print a message
- print 'Skipping %s' % pathname
+ print('Skipping %s' % pathname)
#
TESTDOCDIR="/tmp"
def TEST_findFiles():
- print "########## find 1"
+ print("########## find 1")
rootpath=TESTDOCDIR
listfiles=findFiles(rootpath)
for filename in listfiles:
- print filename
+ print(filename)
- print "########## find 2"
+ print("########## find 2")
excludes=[os.path.join(TESTDOCDIR,"doc")]
listfiles=findFiles(rootpath,excludes)
for filename in listfiles:
- print filename
+ print(filename)
return True
# This is the test callback function
def visitfile_withargs(file, rootid):
- print 'visiting file %s (rootid=%s)'%(file,str(rootid))
+ print('visiting file %s (rootid=%s)'%(file,str(rootid)))
def visitfile_withoutargs(file):
- print 'visiting file %s'%(file)
+ print('visiting file %s'%(file))
def TEST_walktree():
#walktree(TESTDOCDIR, visitfile_withargs, rootid=2)
return True
if __name__ == "__main__":
- import unittester
+ from . import unittester
unittester.run("syshelper", "TEST_findFiles")
unittester.run("syshelper", "TEST_walktree")