diff --git a/tools/preprocess_frozen_modules.py b/tools/preprocess_frozen_modules.py index eb835961f67e3..bfc43d0184691 100755 --- a/tools/preprocess_frozen_modules.py +++ b/tools/preprocess_frozen_modules.py @@ -42,9 +42,13 @@ def version_string(path=None, *, valid_semver=False): return version -# Visit all the .py files in topdir. Replace any __version__ = "0.0.0-auto.0" type of info +# Visit all the .py files in topdir or src. Replace any __version__ = "0.0.0-auto.0" type of info # with actual version info derived from git. def copy_and_process(in_dir, out_dir): + # setuptools default: use modules from 'src' if the directory exists + src_dir = in_dir + os.path.sep + "src" + if os.path.exists(src_dir) and os.path.isdir(src_dir): + in_dir = src_dir for root, subdirs, files in os.walk(in_dir): # Skip library examples directory and subfolders. relative_path_parts = Path(root).relative_to(in_dir).parts