Kaynağa Gözat

Remove use of conditional expressions as they are not supported in Python 2.3.

[SVN r45147]
Rene Rivera 18 yıl önce
ebeveyn
işleme
0c8d55ed25
1 değiştirilmiş dosya ile 21 ekleme ve 6 silme
  1. 21 6
      tools/regression/src/process_jam_log.py

+ 21 - 6
tools/regression/src/process_jam_log.py

@@ -40,6 +40,10 @@ class BJamLog2Results:
         self.revision=None
         self.input = []
         ( _opt_, self.input ) = opt.parse_args(args,self)
+        if self.incremental:
+            run_type = 'incremental'
+        else:
+            run_type = 'full'
         self.results = xml.dom.minidom.parseString('''<?xml version="1.0" encoding="UTF-8"?>
 <test-run
   source="%(source)s"
@@ -55,7 +59,7 @@ class BJamLog2Results:
             'runner' : self.runner,
             'platform' : self.platform,
             'tag' : self.tag,
-            'run-type' : 'incremental' if self.incremental else 'full',
+            'run-type' : run_type,
             'revision' : self.revision,
             } )
         
@@ -233,11 +237,15 @@ class BJamLog2Results:
                             action_tag = 'run'
                     #~ The result sub-part we will add this result to.
                     result_node = self.get_child(log,tag=action_tag)
+                    if action_node.getAttribute('status') == '0':
+                        action_result = 'succeed'
+                    else:
+                        action_result = 'fail'
                     if not result_node:
                         #~ If we don't have one already, create it and add the result.
                         result_node = self.new_text(action_tag,result_data,
-                            result='succeed' if action_node.getAttribute('status') == '0' else 'fail',
-                            timestamp=action_node.getAttribute('start'))
+                            result = action_result,
+                            timestamp = action_node.getAttribute('start'))
                         log.appendChild(self.results.createTextNode("\n"))
                         log.appendChild(result_node)
                     else:
@@ -249,7 +257,7 @@ class BJamLog2Results:
                             if action_node.getAttribute('status') != '0':
                                 result = 'fail'
                         else:
-                            result = 'succeed' if action_node.getAttribute('status') == '0' else 'fail'
+                            result = action_result
                         result_node.setAttribute('result',result)
                         result_node.appendChild(self.results.createTextNode("\n"))
                         result_node.appendChild(self.results.createTextNode(result_data))
@@ -322,6 +330,10 @@ class BJamLog2Results:
         target_directory = re.sub(r'.*[/\\]bin[.]v2[/\\]','',target_directory)
         target_directory = re.sub(r'[\\]','/',target_directory)
         if not target_directory in self.log:
+            if 'info' in test and test['info'] == 'always_show_run_output':
+                show_run_output = 'true'
+            else:
+                show_run_output = 'false'
             self.log[target_directory] = self.new_node('test-log',
                 library=test['library'],
                 test_name=test['test-name'],
@@ -329,7 +341,7 @@ class BJamLog2Results:
                 test_program=test['test-program'],
                 toolset=self.get_toolset(node),
                 target_directory=target_directory,
-                show_run_output='true' if 'info' in test and test['info'] == 'always_show_run_output' else 'false')
+                show_run_output=show_run_output)
         return self.log[target_directory]
     
     #~ The precise toolset from the build properties.
@@ -373,7 +385,10 @@ class BJamLog2Results:
             if not data:
                 data = self.get_child(node,tag='#cdata-section')
             if data:
-                data = data.data if not strip else data.data.strip()
+                if not strip:
+                    data = data.data
+                else:
+                    data = data.data.strip()
         if not data:
             data = default
         return data

粤ICP备19079148号