Skip to content
Snippets Groups Projects
Commit 8ac4768d authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

data-env: ignore hidden directory when searching data-env

We have to use `glob.glob` instead of `pathlib.Path.glob` as the later is too
limited.

Ignoring hidden directly seems like a good idea in general and, in particular,
it will make it simpler to ignore the temporary data-envs in the next changesets.

To stay compatible with older python, we have deal with the location where to
run the glob manually.
parent 8f76ca4b
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@
simplify the usage of Poulpe for benchmarking. It constains and manages the
basic building block of Poulpe
"""
import glob
import os
from pathlib import Path
......@@ -72,6 +74,12 @@
return den_data_envs
def find_benchmarks(self):
files = set()
files.update(self.benchmark_dir.glob("**/*.pbd"))
abs_files = set()
root = self.benchmark_dir
abs_root = str(root.resolve())
lvl_1_glob = glob.escape(abs_root) + "/*/*.pbd"
lvl_2_glob = glob.escape(abs_root) + "/*/*/*.pbd"
# XXX the `root_dir` argument is not supported until python 3.10
abs_files.update(glob.glob(lvl_1_glob, recursive=True))
# bypass the usual top level symlink
......@@ -77,5 +85,7 @@
# bypass the usual top level symlink
files.update(self.benchmark_dir.glob("*/**/*.pbd"))
abs_files.update(glob.glob(lvl_2_glob, recursive=True))
rel_files = [f[len(abs_root) + 1:] for f in abs_files]
files = [root / f for f in rel_files]
bms = [(f, benchmarks.get_benchmark(f)) for f in files]
return sorted(bms, key=lambda x: x[1].name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment