[Rivet-svn] rivet: 2 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Fri Nov 17 18:45:02 GMT 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/d63692d93eb2
branches:  
changeset: 6145:d63692d93eb2
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Fri Nov 17 15:22:19 2017 +0000
description:
More py3 fixes. Check works

details:   https://rivet.hepforge.org/hg/rivet/rev/b44fd6037695
branches:  
changeset: 6146:b44fd6037695
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Fri Nov 17 18:32:49 2017 +0000
description:
Tests work again for py2.7. Need to check all rivet CLI options

diffs (truncated from 232 to 50 lines):

--- a/bin/rivet	Fri Nov 17 10:08:02 2017 +0000
+++ b/bin/rivet	Fri Nov 17 18:32:49 2017 +0000
@@ -209,14 +209,19 @@
                 msg = aname
                 if opts.LOGLEVEL <= logging.INFO:
                     a = rivet.AnalysisLoader.getAnalysis(aname)
-                    st = "" if a.status() == "VALIDATED" else ("[" + a.status() + "] ")
-                    msg = "%-25s   %s" % (aname, st + rivet.util.detex(a.summary()))
+                    st = "" if a.status() == "VALIDATED" else ("[%s] " % a.status())
+                    detex = rivet.util.detex(a.summary())
+                    # detex will very likely introduce some non-ASCII chars from
+                    # greek names in analysis titles.
+                    # The u"" prefix and explicit print encoding are necessary for
+                    # py2 to handle this properly
+                    msg = u"%-25s   %s" % (aname, st + detex)
                     if opts.LOGLEVEL < logging.INFO:
                         if a.keywords():
                             msg += "  [" + " ".join(a.keywords()) + "]"
                         if a.luminosityfb():
                             msg += "  [ \int L = %s fb^{-1} ]"%a.luminosityfb()
-                print(msg)
+                print(msg.encode('utf-8'))
                 #os.write(tf, msg + "\n")
         # if os.path.getsize(tfpath) > 0:
         #     pager = subprocess.Popen(["less", "-FX", tfpath]) #, stdin=subprocess.PIPE)
@@ -542,13 +547,9 @@
 
 def min_nonnull(a, b):
     "A version of min which considers None to always be greater than a real number"
-    rtn = min(a, b)
-    if rtn is not None:
-        return rtn
-    if a is not None:
-        return a
-    return b
-
+    if a is None: return b
+    if b is None: return a
+    return min(a, b)
 
 ## Set up an event timeout handler
 class TimeoutException(Exception):
--- a/include/Rivet/Tools/ParticleName.hh	Fri Nov 17 10:08:02 2017 +0000
+++ b/include/Rivet/Tools/ParticleName.hh	Fri Nov 17 18:32:49 2017 +0000
@@ -4,6 +4,10 @@
 #include "Rivet/Particle.fhh"
 #include "Rivet/Tools/Exceptions.hh"
 
+// cython includes termio.h on some systems,
+// which #defines a B0 = 0 macro


More information about the Rivet-svn mailing list