Salome HOME
sat package: remove the .pyconf file in the root directory of
authorSRE - CEA <serge.rehbinder@cea.fr>
Wed, 28 Jun 2017 13:13:32 +0000 (15:13 +0200)
committerSRE - CEA <serge.rehbinder@cea.fr>
Wed, 28 Jun 2017 13:13:32 +0000 (15:13 +0200)
salomeTools if there is any. (For example when launching jobs, a pyconf
file describing the jobs can be here and is not useful). See
https://codev-tuleap.cea.fr/plugins/tracker/?aid=8517

commands/package.py

index 68c7f19fa217e162e4146b5714f498fb15474675..a3b685923432d87655249d356a861e6b7cef091c 100644 (file)
@@ -684,6 +684,17 @@ def add_salomeTools(config, tmp_working_dir):
     local_pyconf_name = "local.pyconf"
     local_pyconf_dir = os.path.join(tmp_working_dir, "salomeTools", "data")
     local_pyconf_file = os.path.join(local_pyconf_dir, local_pyconf_name)
+    # Remove the .pyconf file in the root directory of salomeTools if there is
+    # any. (For example when launching jobs, a pyconf file describing the jobs 
+    # can be here and is not useful) 
+    files_or_dir_SAT = os.listdir(os.path.join(tmp_working_dir, "salomeTools"))
+    for file_or_dir in files_or_dir_SAT:
+        if file_or_dir.endswith(".pyconf"):
+            file_path = os.path.join(tmp_working_dir,
+                                     "salomeTools",
+                                     file_or_dir)
+            os.remove(file_path)
+    
     ff = open(local_pyconf_file, "w")
     ff.write(LOCAL_TEMPLATE)
     ff.close()