Skip to content

Commit

Permalink
tools: make utils.SearchFiles Python2-compatible
Browse files Browse the repository at this point in the history
PR-URL: #40020
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
targos committed Sep 7, 2021
1 parent 55493f2 commit d39200c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


import glob
import os
import platform
import re
import sys
Expand Down Expand Up @@ -111,7 +111,11 @@ def IsWindows():


def SearchFiles(dir, ext):
list = glob.glob(dir+ '/**/*.' + ext, recursive=True)
matching_files = []
for path, dirs, files in os.walk(dir):
for file in files:
if file.endswith('.' + ext):
matching_files.append(path + '/' + file)
if sys.platform == 'win32':
list = [ x.replace('\\', '/')for x in list]
return list
matching_files = [x.replace('\\', '/') for x in matching_files]
return matching_files

0 comments on commit d39200c

Please sign in to comment.