diff --git a/importlab/utils.py b/importlab/utils.py index 1e40c01..6b508fe 100644 --- a/importlab/utils.py +++ b/importlab/utils.py @@ -56,7 +56,10 @@ def collect_files(path, extension): out = [] # glob would be faster (see PEP471) but python glob doesn't do **/* for root, _, files in os.walk(path): - out += [os.path.join(root, f) for f in files if f.endswith(extension)] + if extension is None: + out += [os.path.join(root, f) for f in files] + else: + out += [os.path.join(root, f) for f in files if f.endswith(extension)] return out @@ -66,26 +69,27 @@ def expand_source_files(filenames, cwd=None): This is a helper function for handling command line arguments that specify a list of source files and directories. - Any directories in filenames will be scanned recursively for .py files. - Any files that do not end with ".py" will be dropped. + Any directories in filenames will be scanned recursively for files. Args: filenames: A list of filenames to process. cwd: An optional working directory to expand relative paths Returns: - A list of sorted full paths to .py files """ out = [] for f in expand_paths(filenames, cwd): if os.path.isdir(f): - # If we have a directory, collect all the .py files within it. - out += collect_files(f, ".py") + # If we have a directory, collect all the files within it. + out += collect_files(f, None) else: + out.append(f) + return set(out) if f.endswith(".py"): out.append(f) return sorted(set(out)) + def split_version(version): return tuple([int(v) for v in version.split('.')])