From c7cce36b68d8a8a43b5063662a9a412b3c313c98 Mon Sep 17 00:00:00 2001
From: Graeme Stewart <graemes.cern@gmail.com>
Date: Sat, 7 Feb 2015 11:59:30 +0100
Subject: [PATCH] * bin/pkgco.py 	- Fix pkgco.py for checkout of Gaudi
 packages 	* python/RootUtils.py 	- Enable cppyy in import_root helper 
 * Tagging as PyUtils-00-14-11 (PyUtils-00-14-11)

	* bin/pkgco.py
	- Fix pkgco.py for checkout of Gaudi packages
	* python/RootUtils.py
	- Enable cppyy in import_root helper
	* Tagging as PyUtils-00-14-11

2015-01-16  Marcin Nowak  <Marcin.Nowak@cern.ch>
	* python\Dso.py: Add ROOT6 setup
	* Tagging as PyUtils-00-14-10

2014-12-22 Peter van Gemmeren  <gemmeren@anl.gov>
	* python/scripts/diff_root_files.py: Add ROOT6 setup
	* Tagging as PyUtils-00-14-09

2014-12-18 Graeme Stewart <graeme.andrew.stewart@cern.ch>
	* python/AmiLib.py
	- Remove duplicate results from get_pkg_info
	* python/scripts/tc_submit_tag.py
	- Fix readline history in query_project
---
 Tools/PyUtils/bin/pkgco.py                      |  4 ++--
 Tools/PyUtils/python/AmiLib.py                  | 10 ++++------
 Tools/PyUtils/python/Dso.py                     | 10 +++++++---
 Tools/PyUtils/python/RootUtils.py               |  4 ++--
 Tools/PyUtils/python/scripts/diff_root_files.py |  5 ++++-
 Tools/PyUtils/python/scripts/tc_submit_tag.py   |  6 +++---
 6 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/Tools/PyUtils/bin/pkgco.py b/Tools/PyUtils/bin/pkgco.py
index bf4a548ea6c..9d5ee1f9598 100755
--- a/Tools/PyUtils/bin/pkgco.py
+++ b/Tools/PyUtils/bin/pkgco.py
@@ -70,7 +70,7 @@ def svn_tag_equals_trunk(pkg,tag):
    pkg_url = os.path.join(svnroot, pkg)
    if pkg.startswith('Gaudi'):
       env['GAUDISVN'] = env.get('GAUDISVN',
-                                'http://svnweb.cern.ch/guest/gaudi')
+                                'http://svn.cern.ch/guest/gaudi')
       svnroot = env['SVNROOT'] = '${GAUDISVN}/Gaudi'
       env['SVNTRUNK'] = 'trunk'
       env['SVNTAGS'] = 'tags'
@@ -111,7 +111,7 @@ def checkout(pkg, head, doCheckOut=True, showRecent=False):
    if pkg.startswith('Gaudi'):
       env = dict(os.environ)
       env['GAUDISVN'] = env.get('GAUDISVN',
-                                'http://svnweb.cern.ch/guest/gaudi')
+                                'http://svn.cern.ch/guest/gaudi')
       env['SVNROOT'] = '%(GAUDISVN)s/Gaudi' % env
       env['SVNTRUNK'] = 'trunk'
       env['SVNTAGS'] = 'tags'
diff --git a/Tools/PyUtils/python/AmiLib.py b/Tools/PyUtils/python/AmiLib.py
index 5e548806a5e..fea74983e1c 100644
--- a/Tools/PyUtils/python/AmiLib.py
+++ b/Tools/PyUtils/python/AmiLib.py
@@ -323,18 +323,16 @@ class Client(object):
         raw_result_list = amijsontodict(result)
         self.msg.debug(pprint.pformat(raw_result_list))
         
-        #import code
-        #code.interact(local=locals())
-
-        results = []
+        # Use a set to remove duplicated results in the key we're interested in
+        results = set()
         for res in raw_result_list:
             if filterRelease:
                 if res.get("releaseName") != release:
                     continue
             if resultKey in res:
-                results.append(res[resultKey])
+                results.add(res[resultKey])
 
-        return results
+        return list(results)
 
     ## @brief retrieve the package version from AMI taking into account project dependencies
     def get_version_of_pkg_with_deps(self, pkg, project, release):        
diff --git a/Tools/PyUtils/python/Dso.py b/Tools/PyUtils/python/Dso.py
index bfdf80057e1..76d031c6b16 100755
--- a/Tools/PyUtils/python/Dso.py
+++ b/Tools/PyUtils/python/Dso.py
@@ -17,6 +17,9 @@ __all__ = [
 import os
 import re
 
+from PyUtils.Helpers import ROOT6Setup
+ROOT6Setup()
+
 def _libName(lib):
     import platform
     if platform.system() == "Linux":
@@ -172,7 +175,8 @@ def gen_typeregistry_dso(oname=_dflt_typereg_fname):
     import cppyy
     _load_lib = cppyy.loadDict
 
-    if not hasattr(cppyy, 'hasFakeCintex '):
+    if int(cppyy.get_version().split('.')[0]) < 6:
+        # load reflex for ROOT ver<6
         msg.debug("::: loading reflex")
         _load_lib('libReflexRflx.so')
         rflx = cppyy.makeNamespace('Reflex')
@@ -324,8 +328,8 @@ class CxxDsoDb(object):
         import PyUtils.RootUtils as ru
         ROOT = ru.import_root()
         self._cxx = ROOT.Ath.DsoDb.instance()
-        if not hasattr(cppyy, 'hasFakeCintex '):
-           # load reflex
+        if int(cppyy.get_version().split('.')[0]) < 6:
+           # load reflex for ROOT ver<6
            _load_dict = cppyy.loadDict
            _load_dict('ReflexRflx')
            self._rflx = cppyy.makeNamespace('Reflex')
diff --git a/Tools/PyUtils/python/RootUtils.py b/Tools/PyUtils/python/RootUtils.py
index 77cef093063..b6092915332 100644
--- a/Tools/PyUtils/python/RootUtils.py
+++ b/Tools/PyUtils/python/RootUtils.py
@@ -8,7 +8,7 @@
 from __future__ import with_statement
 
 __doc__ = "a few utils to ease the day-to-day work with ROOT"
-__version__ = "$Revision: 632456 $"
+__version__ = "$Revision: 644959 $"
 __author__ = "Sebastien Binet"
 
 __all__ = [
@@ -38,7 +38,7 @@ def import_root(batch=True):
     ROOT.gROOT.SetBatch(batch)
     if batch:
         ROOT.PyConfig.IgnoreCommandLineOptions = True
-    #import PyCintex;    PyCintex.Cintex.Enable()
+    import cppyy
     return ROOT
 
 def root_compile(src=None, fname=None, batch=True):
diff --git a/Tools/PyUtils/python/scripts/diff_root_files.py b/Tools/PyUtils/python/scripts/diff_root_files.py
index fa181777864..2cbf0715216 100644
--- a/Tools/PyUtils/python/scripts/diff_root_files.py
+++ b/Tools/PyUtils/python/scripts/diff_root_files.py
@@ -5,7 +5,7 @@
 # @author Sebastien Binet
 # @date February 2010
 
-__version__ = "$Revision: 543921 $"
+__version__ = "$Revision: 637362 $"
 __doc__ = "check that 2 ROOT files have same content (containers and sizes)."
 __author__ = "Sebastien Binet"
 
@@ -92,6 +92,9 @@ def main(args):
     msg = L.logging.getLogger('diff-root')
     msg.setLevel(L.logging.INFO)
 
+    from PyUtils.Helpers import ShutUp, ROOT6Setup
+    ROOT6Setup()
+
     if args.entries == '':
         args.entries = -1
         
diff --git a/Tools/PyUtils/python/scripts/tc_submit_tag.py b/Tools/PyUtils/python/scripts/tc_submit_tag.py
index e77cfb8a5ce..df64c246a5e 100644
--- a/Tools/PyUtils/python/scripts/tc_submit_tag.py
+++ b/Tools/PyUtils/python/scripts/tc_submit_tag.py
@@ -5,7 +5,7 @@
 # @author Sebastien Binet
 # @date February 2010
 
-__version__ = "$Revision: 636803 $"
+__version__ = "$Revision: 636895 $"
 __doc__ = "Submit one or more TAGs to TagCollector."
 __author__ = "Sebastien Binet, Frank Winklmeier"
 
@@ -59,7 +59,7 @@ def query_project(projects, release, pkg):
 
     readline.clear_history()
     for r in reversed(projects):
-        readline.add_history(p)
+        readline.add_history(r)
 
     choice = raw_input("Select (comma separated or '*' for all): ")
 
@@ -221,7 +221,7 @@ def main(args):
                 if len(proj)==0:
                     _projects.append(None)
                     continue
-                v = query_project(proj, rel, pkg)
+                v = query_project(proj, rel, pkg['packageName'])
                 _projects.append(v)
                 pass # pkgs
             if not args.project:
-- 
GitLab