# =====================================================================
# create VARS section
var = self._create_vars(application=application, command=command, datadir=datadir)
- DBG.write("create_vars", var, DBG.isDeveloper())
+ # DBG.write("create_vars", var, DBG.isDeveloper())
# add VARS to config
cfg.VARS = src.pyconf.Mapping(cfg)
else:
return found
+def purgeEmptyNodes(root):
+ """
+ recursive remove node.text and node.tail if empty node
+ as nothing else than whitespace(s) and RCLF(s)
+
+ | this is comes from
+ | 1) pretty print file xml -> creates indentation(s) in text and tail
+ | 2) and reload parse file xml
+ """
+ # print("root", root.tag, root.text)
+ text = root.text
+ tail = root.tail
+ if text is not None:
+ if text.replace(" ", "").replace("\n", "") == "":
+ # print("purgeEmptyNodes text %s" % root.tag)
+ root.text = None
+ if tail is not None:
+ if tail.replace(" ", "").replace("\n", "") == "":
+ # print("purgeEmptyNodes tail %s" % root.tag)
+ root.tail = None
+ for node in root:
+ purgeEmptyNodes(node)
+ return
+
##
# Creates the XML report for a product.
def create_test_report(config,
else:
print("Log file modification %s" % xml_history_path)
root = etree.parse(xml_history_path).getroot()
+ purgeEmptyNodes(root)
prod_node = root.find("product")
for testbase in tt.keys():
if verbose: print("---- create_test_report %s %s" % (testbase, first_time))
gn = findOrCreateNode(tests, "testbase")
-
+
# initialize all grids and session to "not executed"
for mn in gn.findall("grid"):
mn.attrib["executed_last_time"] = "no"
like open a browser or an editor, or call a git command
'''
-import subprocess
import os
+import subprocess
+import time
import tarfile
import debug as DBG
cmd = r"""
set -x
-rmdir %(where)s && \
+rmdir %(where)s
git clone %(remote)s %(where)s && \
git --git-dir=%(where_git)s --work-tree=%(where)s checkout %(tag)s
"""
logger.logTxtFile.flush()
DBG.write("cmd", cmd)
- rc = UTS.Popen(cmd, cwd=str(where.dir()), env=environment.environ.environ, logger=logger)
+
+ for nbtry in range(0,3): # retries case of network problem
+ rc = UTS.Popen(cmd, cwd=str(where.dir()), env=environment.environ.environ, logger=logger)
+ if rc.isOk(): break
+ time.sleep(30) # wait a little
+
return rc.isOk()
"""
cmd = r"""
set -x
export tmpDir=%(tmpWhere)s && \
-rm -rf $tmpDir && \
+rm -rf $tmpDir
git clone %(remote)s $tmpDir && \
cd $tmpDir && \
git checkout %(tag)s && \
rm -rf $tmpDir
""" % aDict
DBG.write("cmd", cmd)
- rc = UTS.Popen(cmd, cwd=parentWhere, env=environment.environ.environ, logger=logger)
- return rc.isOk()
+ for nbtry in range(0,3): # retries case of network problem
+ rc = UTS.Popen(cmd, cwd=parentWhere, env=environment.environ.environ, logger=logger)
+ if rc.isOk(): break
+ time.sleep(30) # wait a little
+
+ return rc.isOk()
def archive_extract(from_what, where, logger):
'''Extracts sources from an archive.