Skip to content

Add option to remove colour from confTool output

Stewart Martin-Haugh requested to merge smh/athena:noColor into master

The coloured output from confTool looks nice in a terminal, but looks like this:


    >>  ^[[0monly in 1st file : ^[[92m [('CondAttrListCollection', '/MDT/CABLING/MAP_SCHEMA'), ('AthenaAttributeList', '/LAR/Identifier/CalibIdMap'), ('CondAttrListCollection', '/MDT/CABLING/MEZZANINE_SCHEMA'), ('CondAttrListCollection', '/TILE/ONL01/NOISE/SAMPLE'), ('CondAttrListCollection', '/TILE/ONL01/TIME/CHANNELOFFSET/PHY'), ('CondAttrListCollection', '/LAR/ElecCalibFlat/HVScaleCorr')] ^[[0m
^[[91m Component DetDescrCnvSvc differ ^[[0m
  ^[[94mDecodeIdDict = ^[[92mTrue ^[[0m only in 1st file ^[[0m
^[[91m Component GeoModelSvc differ ^[[0m
  ^[[94mDetectorTools = ^[[92m ['PixelDetectorTool/PixelDetectorTool', 'SCT_DetectorTool/SCT_DetectorTool', 'TRT_DetectorTool/TRT_DetectorTool', 'InDetServMatTool/InDetServMatTool', 'LArDetectorToolNV/LArDetectorToolNV', 'TileDetectorTool/TileDetectorTool', 'MuonDetectorTool/MuonDetectorTool', 'BeamPipeDetectorTool/BeamPipeDetectorTool'] ^[[0m vs ^[[35m ['LArDetectorToolNV/LArDetectorToolNV', 'TileDetectorTool/TileDetectorTool', 'MuonDetectorTool/MuonDetectorTool', 'BeamPipeDetectorTool/BeamPipeDetectorTool', 'InDetServMatTool/InDetServMatTool', 'PixelDetectorTool/PixelDetectorTool', 'SCT_DetectorTool/SCT_DetectorTool', 'TRT_DetectorTool/TRT_DetectorTool'] ^[[0m  ^[[91m<<^[[0m
    >>  : ^[[91m ^^ Different order ^^ ^[[0m
^[[91m Component GeoModelSvc.InDetServMatTool differ ^[[0m
  ^[[94mGeometryDBSvc = ^[[92m InDetGeometryDBSvc ^[[0m vs ^[[35m GeometryDBSvc/InDetGeometryDBSvc ^[[0m  ^[[91m<<^[[0m
^[[91m Component GeoModelSvc.PixelDetectorTool differ ^[[0m
  ^[[94mGeometryDBSvc = ^[[92m InDetGeometryDBSvc ^[[0m vs ^[[35m GeometryDBSvc/InDetGeometryDBSvc ^[[0m  ^[[91m<<^[[0m
^[[91m Component GeoModelSvc.SCT_DetectorTool differ ^[[0m
  ^[[94mGeometryDBSvc = ^[[92m InDetGeometryDBSvc ^[[0m vs ^[[35m GeometryDBSvc/InDetGeometryDBSvc ^[[0m  ^[[91m<<^[[0m
^[[91m Component GeoModelSvc.TRT_DetectorTool differ ^[[0m
  ^[[94mGeometryDBSvc = ^[[92m InDetGeometryDBSvc ^[[0m vs ^[[35m GeometryDBSvc/InDetGeometryDBSvc ^[[0m  ^[[91m<<^[[0m
^[[91m Component IOVDbSvc differ ^[[0m
   ^[[0monly in 1st file : ^[[92m ['{"db": "COOLONL_LAR/CONDBR2", "name": "/LAR/ElecCalibFlat/HVScaleCorr"}', '{"db": "COOLONL_TILE/CONDBR2", "key": "/TILE/ONL01/NOISE/SAMPLE", "name": "/TILE/ONL01/NOISE/SAMPLE"}', '{"db": "COOLONL_TILE/CONDBR2", "key": "/TILE/ONL01/TIME/CHANNELOFFSET/PHY", "name": "/TILE/ONL01/TIME/CHANNELOFFSET/PHY"}', '{"db": "COOLONL_LAR/CONDBR2", "name": "/LAR/Identifier/CalibIdMap"}', '{"db": "COOLONL_MDT/CONDBR2", "name": "/MDT/CABLING/MEZZANINE_SCHEMA"}', '{"db": "COOLONL_MDT/CONDBR2", "name": "/MDT/CABLING/MAP_SCHEMA"}'] ^[[0m

in a text editor (certainly less, diff and emacs have this issue). For large diffs I usually want to work directly with the text file.

This MR turns off coloured output when python detects that it's being piped to a file.

Cheers,

Stewart

Edited by Stewart Martin-Haugh

Merge request reports