From 1b98ce86b0155a70bca9c8568c39ec42169f7840 Mon Sep 17 00:00:00 2001 From: Brian Gladman Date: Sat, 2 Nov 2019 20:59:12 +0000 Subject: [PATCH] improve directory scanning in mpir_config.py --- msvc/mpir_config.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/msvc/mpir_config.py b/msvc/mpir_config.py index 420e82cf..e085b51f 100644 --- a/msvc/mpir_config.py +++ b/msvc/mpir_config.py @@ -5,9 +5,9 @@ Copyright (C) 2011, 2012, 2013, 2014 Brian Gladman ''' from operator import itemgetter -from os import listdir, walk, unlink, makedirs, sep -from os.path import split, splitext, isdir, relpath, join, exists -from os.path import join, abspath, dirname, normpath, split +from os import scandir, walk, unlink, makedirs +from os.path import join, split, splitext, isdir, exists +from os.path import dirname, abspath, relpath, realpath from copy import deepcopy from sys import argv, exit, path from filecmp import cmp @@ -27,7 +27,7 @@ if len(argv) > 1: solution_name = 'mpir.sln' build_dir_name = 'vs{0:d}'.format(vs_version) -build_root_dir = dirname(__file__) +build_root_dir = dirname(realpath(__file__)) mpir_root_dir, build_root_name = split(build_root_dir) solution_dir = join(build_root_dir, build_dir_name) @@ -179,11 +179,11 @@ def find_src(dir_list): di = {'.h': 0, '.c': 1, '.cc': 2, '.cpp': 2, '.asm': 3, '.as': 3} list = [[], [], [], []] for d in dir_list: - for f in listdir(join(mpir_root_dir, d)): + for f in scandir(join(mpir_root_dir, d)): if f == '.svn': continue # ignore SVN directories if not isdir(f): - n, x = splitext(f) # split into name + extension + n, x = splitext(f.name) # split into name + extension if x in di and not n in exclude_file_list: list[di[x]] += [(n, x, d)] # if of the right type and is for x in list: # not in the exclude list