From 252a697984e734860da2a408597a722c2a740025 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 6 Feb 2022 13:28:45 +0000 Subject: [PATCH] test/overlay/__init__.py: support directory tree under fakemods --- test/overlay/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/overlay/__init__.py b/test/overlay/__init__.py index 9ea92087..30846cfa 100644 --- a/test/overlay/__init__.py +++ b/test/overlay/__init__.py @@ -6,8 +6,10 @@ def get_overlay_dir(repo_root): def overlay_setup(repo_root): def process_srcdir(d): - srcdir = os.path.join(repo_root,*d.split('.')) - destdir = os.path.join(overlay_dir,*d.split('.')) + relpath = d.split('.') + srcdir = os.path.join(repo_root,*relpath) + destdir = os.path.join(overlay_dir,*relpath) + fakemod_dir = os.path.join(fakemod_root,*(relpath[1:])) os.makedirs(destdir) for fn in os.listdir(srcdir): if ( @@ -15,7 +17,7 @@ def overlay_setup(repo_root): d == 'mmgen.data' or d == 'mmgen' and fn.startswith('secp256k1') ): - if d == 'mmgen' and fn in fakemods: + if os.path.exists(os.path.join(fakemod_dir,fn)): make_link( os.path.join(fakemod_dir,fn), os.path.join(destdir,fn) ) @@ -28,8 +30,7 @@ def overlay_setup(repo_root): os.path.join(destdir,link_fn) ) overlay_dir = get_overlay_dir(repo_root) - fakemod_dir = os.path.join(repo_root,'test','overlay','fakemods') - fakemods = os.listdir(fakemod_dir) + fakemod_root = os.path.join(repo_root,'test','overlay','fakemods') make_link = os.symlink if sys.platform == 'linux' else shutil.copy2 if not os.path.exists(os.path.join(overlay_dir,'mmgen','main.py')):