[Blends-commit] [SCM] website branch, master, updated. 231677f792b62d67e79f08b027665a00ee82ef17

Akshita Jha akshita-guest at users.alioth.debian.org
Thu Aug 6 10:51:17 UTC 2015


The following commit has been merged in the master branch:
commit 93f945b522973694cd6f046bde50f53cc5e55682
Author: Akshita Jha <akshita-guest at users.alioth.debian.org>
Date:   Thu Aug 6 13:52:43 2015 +0530

    Modify test_ouput.py : Add -s (--sloppy) flag. If '-s' flag is used, the diff between publication class in the tasks files is not computed

diff --git a/webtools_py3/test_output.py b/webtools_py3/test_output.py
index 35f4bae..b166d0b 100755
--- a/webtools_py3/test_output.py
+++ b/webtools_py3/test_output.py
@@ -11,6 +11,7 @@ import re
 
 from blendstasktools_udd import ReadConfig
 
+s = 0  # for --sloppy flag
 
 # parse the HTML Output
 class BlendsHTMLParser(HTMLParser):
@@ -18,18 +19,30 @@ class BlendsHTMLParser(HTMLParser):
         HTMLParser.__init__(self, convert_charrefs=True)
         self.tmp = ''
         self.data = []
+        self.flag = 0
 
     def handle_starttag(self, tag, attrs):
+        global s
         #self.tmp.append("start_tag : %s" %tag.strip())
         self.tmp = self.tmp + " <start_tag> : %s" %tag.strip()
         for attr in attrs:
             #self.tmp.append("attr : %s" %str(attr).strip())
+            # self.flag = 1, for entire class publshed
+            if s == 1:
+                if attr[1] == 'published' or attr[1] == 'journal' or attr[1] == 'year':
+                    self.flag = 1
+
             self.tmp = self.tmp + " <attr> : %s" %str(attr).strip()
 
     def handle_endtag(self, tag):
         #self.tmp.append("end_tag : %s" %tag.strip())
         self.tmp = self.tmp + " <end_tag> : %s" %tag.strip()
-        self.data.append(self.tmp)
+        # if self.flag == 1, do not append to list
+        # hence diff for this will not be calculated
+        if self.flag == 0:
+            self.data.append(self.tmp)
+        elif self.flag == 1:
+            self.flag = 0
         self.tmp = ''
 
     def handle_data(self, data):
@@ -119,15 +132,34 @@ def task_file(dir_path, lang=''):
 
 
 def main():
+    global s
     if len(sys.argv) <= 1:
         print("Usage: ./test_output.py <Blend> <optional lang>\nOutput directory : ./tests/<Blend>/<task_file.diff>")
         exit(-1)
 
-    blend = sys.argv[1]
-    if len(sys.argv) > 2:
-        lang = sys.argv[2]
+    blend = ''  # to store name of blend
+    lang = '' # for diff in additional lang
+
+    if sys.argv[1] == '-s':
+        s = 1
+        blend = sys.argv[2]
+        if len(sys.argv) == 4:
+            lang = sys.argv[3]
+        elif len(sys.argv) == 3:
+            lang = ''
+        else:
+            print("Usage: ./test_output.py <Blend> <optional lang>\nOutput directory : ./tests/<Blend>/<task_file.diff>")
+            exit(-1)
     else:
-        lang = ''
+        s = 0
+        blend = sys.argv[1]
+        if len(sys.argv) == 3:
+            lang = sys.argv[2]
+        elif len(sys.argv) == 2:
+            lang = ''
+        else:
+            print("Usage: ./test_output.py <Blend> <optional lang>\nOutput directory : ./tests/<Blend>/<task_file.diff>")
+            exit(-1)
 
     data = ReadConfig(blend)
     outputdir = data['outputdir']

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list