[PATCH] Recursively copy files before config test

msuraev at sysmocom.de msuraev at sysmocom.de
Thu Apr 7 12:11:25 UTC 2016


From: Max <msuraev at sysmocom.de>

Copy all potentially necessary files (like includable configs) before
running config test.
---
 osmopy/osmotestconfig.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/osmopy/osmotestconfig.py b/osmopy/osmotestconfig.py
index b020d86..5c981d1 100644
--- a/osmopy/osmotestconfig.py
+++ b/osmopy/osmotestconfig.py
@@ -17,7 +17,7 @@
 import os
 import os.path
 import time
-import sys
+import sys, shutil
 import tempfile
 
 import osmopy.obscvty as obscvty
@@ -72,15 +72,15 @@ def test_config_atest(app_desc, config, run_test, verbose=True):
 
     return ret
 
-
 def copy_config(dirname, config):
+    shutil.rmtree(dirname, True)
+    ign = shutil.ignore_patterns('*.cfg')
+    shutil.copytree(os.path.dirname(config), dirname, ignore=ign)
+
     try:
         os.stat(dirname)
     except OSError:
         os.mkdir(dirname)
-    else:
-        remove_tmpdir(dirname)
-        os.mkdir(dirname)
 
     prefix = os.path.basename(config)
     tmpfile = tempfile.NamedTemporaryFile(
-- 
2.8.1




More information about the OpenBSC mailing list