buildframework/helium/sf/python/pythoncore/lib/dependancygraph.py
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
parent 587 85df38eb4012
child 645 b8d81fa19e7d
permissions -rw-r--r--
helium_11.0.0-e00f171ca185
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
#============================================================================ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
#Name        : dependancygraph.py
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
#Part of     : Helium 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
#All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
#This component and the accompanying materials are made available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
#under the terms of the License "Eclipse Public License v1.0"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
#which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
#Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
#Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
#Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
#Description:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
#===============================================================================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
"""create the dependancy graph for the documentation"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
import os
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
import amara
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
import codecs
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
import zipfile
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
class Library:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
    """ Class Library holds information of the required modules or components such as license and the version """
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    28
    def __init__(self, name, license_, version=''):
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
        self.name = name
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    30
        self.license_ = license_
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
        self.version = version
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
        self.requires = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
class ModuleGroup:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
    """ This class represents a group of module """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
    def __init__(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
        self.libraries = {}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
    def addConf(self, name, des, color):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
        """add configuration"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
        self.libraries[name] = (des, [], color)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
    def addLibrary(self, conf, library):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
        """add library"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
        for lib in self.getLibraries(conf):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
            if lib.name.lower() == library.name.lower():
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    45
                lib.license_ = library.license_
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
                return
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
        self.getLibraries(conf).append(library)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
    def getLibraries(self, conf):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
        """get Libraries"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
        (_, libs, _) = self.libraries[conf]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
        return libs
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
    def getDescription(self, conf):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
        """get description"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
        (des, _, _) = self.libraries[conf]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
        return des
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
    def getColor(self, conf):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
        """get colour"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
        (_, _, color) = self.libraries[conf]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
        return color
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
COLORS = ['pink', 'red', 'lightblue', 'orange', 'green', 'yellow', 'turquoise', 'limegreen']
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
class ReadIvyConfig:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
    """ Class to read the ivy configuration """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
    def __init__(self, ivyfilename):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
        self.ivyfilename = ivyfilename
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
        self.ivyxml = amara.parse(open(ivyfilename))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
        self.group = ModuleGroup()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
    def readConfigurations(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
        """read configurations"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
        for conf in self.ivyxml['ivy-module'].configurations.conf:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
            color = COLORS.pop()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
            self.group.addConf(conf.name, conf.description, color)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
    def readModules(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
        """read modules"""
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    78
        license_ = ''
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
        for module in self.ivyxml['ivy-module'].dependencies.xml_children:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
            if hasattr(module, 'data'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
                if 'License:' in module.data:
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    82
                    license_ = module.data.strip()
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
            elif hasattr(module, 'name'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
                modulename = module.name.replace('-', '_')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
            
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
                if module.org != 'SWEPT':
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    87
                    self.group.addLibrary(module.conf, Library(modulename, license_))
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    88
                    license_ = ''
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
    def readSubModules(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
        """read Sub Modules"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    92
        for module in self.ivyxml['ivy-module'].dependencies.xml_children:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    93
            if hasattr(module, 'name'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    94
                if 'jars' in module.name:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
                    ivydir = os.path.dirname(self.ivyfilename)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
                    ivydir = os.path.join(ivydir, 'modules')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
                    ivyjarfile = os.path.join(ivydir, module.name + '-1.0.ivy.xml')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
                    ivymodulexml = amara.parse(open(ivyjarfile))
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    99
                    license_ = ''
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
                    for artifact in ivymodulexml['ivy-module'].publications.xml_children:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
                        if hasattr(artifact, 'data'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
                            if 'License:' in artifact.data:
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   103
                                license_ = artifact.data.strip()
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   104
                        elif hasattr(artifact, 'name'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   105
                            bits = artifact.name.split('-')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
                            name = bits[0]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   107
                            version = ''
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
                            if len(bits) > 1:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   109
                                version = bits[1]
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   110
                            self.group.addLibrary(module.conf, Library(name, license_, version))
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   111
                            license_ = ''
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   113
PYTHON_GROUP = True
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   114
SUBCON_PYTHON_GROUP = False
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
def readEggs(libraries, dirtosearch, internaldir):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   117
    """read Egg files"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
    libraries.addConf(PYTHON_GROUP, 'Python libs', libraries.getColor('core_install'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
    libraries.addConf(SUBCON_PYTHON_GROUP, 'Python subcon libs', libraries.getColor('subcon'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
    for _xx in [os.walk(dirtosearch, topdown=False), os.walk(internaldir, topdown=False)]:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   122
        for root, _, files in _xx:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   123
            notinsubcon = os.path.normpath(internaldir) in os.path.normpath(root)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   124
            
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   125
            for fname in files:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   126
                filename = os.path.join(root, fname)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   127
                if fname == 'PKG-INFO':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   128
                    pkgmetafile = open(filename)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   129
                    library = readPkgInfo(pkgmetafile)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   130
                    pkgmetafile.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   131
                    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   132
                    requirefilename = os.path.join(filename, '..', 'requires.txt')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   133
                    if os.path.exists(requirefilename):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   134
                        requiresfile = open(requirefilename)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   135
                        readRequiresFile(requiresfile, library)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   136
                        requiresfile.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   137
                        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   138
                    libraries.addLibrary(notinsubcon, library)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   139
                    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   140
                if os.path.isfile(filename) and fname.endswith('.egg'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   141
                    eggfile = zipfile.ZipFile(filename, 'r', zipfile.ZIP_DEFLATED)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   142
                    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   143
                    data = eggfile.read('EGG-INFO/PKG-INFO')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   144
                    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   145
                    library = readPkgInfo(data.split('\n'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   146
                    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   147
                    if 'EGG-INFO/requires.txt' in eggfile.namelist():
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   148
                        requiresdata = eggfile.read('EGG-INFO/requires.txt')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   149
                        readRequiresFile(requiresdata.split('\n'), library)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   150
                        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   151
                    libraries.addLibrary(notinsubcon, library)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   152
                    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   153
                    eggfile.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   154
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   155
def readRequiresFile(data, library):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   156
    """read Requires File"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   157
    for line in data:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   158
        line = line.strip()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   159
        if line != '' and not (line.startswith('[') and line.endswith(']')):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   160
            library.requires.append(line.split('>=')[0].strip())
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   161
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   162
def readPkgInfo(data):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   163
    """read Pkg info"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   164
    name = ''
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   165
    version = ''
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   166
    license_ = ''
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   167
    license2 = ''
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   168
  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   169
    for line in data:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   170
        if 'Name:' in line:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   171
            name = line.strip().replace('Name: ', '')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   172
        if 'Version:' in line:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   173
            version = line.strip().replace('Version: ', '')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   174
        if 'License:' in line:
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   175
            license_ = line.strip().replace('License: ', '')
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   176
        if 'Classifier: License :: ' in line:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   177
            license2 = license2 + ' ' + line.strip().replace('Classifier: License :: ', '').replace('OSI Approved :: ', '')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   178
    
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   179
    if license_.lower() == 'unknown' or license_ == '' or license2 != '':
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   180
        license_ = license2
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   181
    
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   182
    return Library(name, license_, version)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   183
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   184
def addLicensesColors(graphdata, group):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   185
    """add license colours"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   186
    newgraphdata = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   187
    for line in graphdata:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   188
        newline = line
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   189
        for conf in group.libraries:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   190
            for module in group.getLibraries(conf):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   191
                if module.name.lower() in line.lower() and 'label=' in line:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   192
                    newline = line.replace('label=', 'color=%s,label=' % group.getColor(conf))
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   193
                    if module.license_ != '':
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   194
                        newline = newline.replace("\"];", "|%s\"];" % module.license_)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   195
                    break
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   196
        newgraphdata.append(newline)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   197
    return newgraphdata
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   198
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   199
def createKey(group):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   200
    """create key"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   201
    key = """subgraph cluster1 {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   202
    label = "Key";
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   203
    style=filled;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   204
    color=lightgrey;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   205
    """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   206
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   207
    for conf in group.libraries:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   208
        if conf != PYTHON_GROUP and conf != SUBCON_PYTHON_GROUP:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   209
            key = key + "\"%s: %s\" [style=filled,color=%s];" % (conf, group.getDescription(conf), group.getColor(conf))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   210
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   211
    key = key + "}"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   212
    return key
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   213
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   214
def createGraph(ivyxmlfilename, graphfilename, dirtosearch, internaldir, subcon):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   215
    """create graph """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   216
    readivy = ReadIvyConfig(ivyxmlfilename)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   217
    readivy.readConfigurations()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   218
    readivy.readModules()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   219
    readivy.readSubModules()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   220
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   221
    group = readivy.group
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   222
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   223
    readEggs(group, dirtosearch, internaldir)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   224
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   225
    key = createKey(group)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   226
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   227
    graphdata = loadGraphFile(graphfilename)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   228
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   229
    newgraphdata = addLicensesColors(graphdata, group)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   230
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   231
    #add key to graph
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   232
    newgraphdata[-1] = newgraphdata[-1].replace('}', key + '\n}')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   233
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   234
    graphwritefile = codecs.open(graphfilename, 'w', 'utf8')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   235
    graphwritefile.writelines(newgraphdata)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   236
    graphwritefile.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   237
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   238
    linkPythonLibs(group, graphfilename, subcon)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   239
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   240
def loadGraphFile(graphfilename):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   241
    """load graph file"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   242
    destgraphfile = codecs.open(graphfilename, 'r', 'utf8')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   243
    graphdata = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   244
    for line in destgraphfile:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   245
        graphdata.append(line)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   246
    destgraphfile.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   247
    return graphdata
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   248
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   249
def addToGraph(graphfilenametoadd, destgraphfilename):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   250
    """add to graph"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   251
    graphdata = loadGraphFile(destgraphfilename)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   252
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   253
    graphfile = codecs.open(graphfilenametoadd, 'r', 'utf8')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   254
    graphdatatoadd = ''
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   255
    for line in graphfile:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   256
        line = line.replace('digraph {', '')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   257
        graphdatatoadd = graphdatatoadd + line
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   258
    graphfile.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   259
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   260
    graphdata[-1] = graphdata[-1].replace('}', graphdatatoadd)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   261
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   262
    graphwritefile = codecs.open(destgraphfilename, 'w', 'utf8')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   263
    graphwritefile.writelines(graphdata)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   264
    graphwritefile.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   265
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   266
def linkPythonLibs(libraries, destgraphfilename, subcon):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   267
    """link Python Libraries"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   268
    graphdata = loadGraphFile(destgraphfilename)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   269
  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   270
    output = "helium_ant -> helium_python;\n"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   271
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   272
    if subcon:
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   273
        libs_list = [SUBCON_PYTHON_GROUP]
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   274
    else:
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   275
        libs_list = [SUBCON_PYTHON_GROUP, PYTHON_GROUP]
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   276
    
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   277
    for group in libs_list:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   278
        for lib in libraries.getLibraries(group):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   279
            output = output + ("helium_python -> \"%s\";\n" % lib.name)
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   280
            output = output + ("\"%s\" [style=filled,shape=record,color=%s,label=\"%s %s|%s\"];\n" % (lib.name, libraries.getColor(group), lib.name, lib.version, lib.license_))
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   281
            
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   282
            for require in lib.requires:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   283
                output = output + ("\"%s\" -> \"%s\";\n" % (lib.name, require))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   284
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   285
    graphdata.reverse()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   286
    for line in graphdata:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   287
        if line.strip() == '':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   288
            graphdata.pop(0)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   289
        else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   290
            break
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   291
    graphdata.reverse()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   292
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   293
    graphdata[-1] = graphdata[-1].replace('}', output + '}')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   294
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   295
    graphwritefile = codecs.open(destgraphfilename, 'w', 'utf8')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   296
    graphwritefile.writelines(graphdata)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   297
    graphwritefile.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   298
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   299
def externalDependancies(database, output):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   300
    """External Dependancies"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   301
    out = open(output, 'w')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   302
    dbase = amara.parse(open(database))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   303
    out.write('digraph G {\n')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   304
    for proj in dbase.antDatabase.project:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   305
        items = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   306
        if hasattr(proj, 'property'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   307
            for prop in proj.property:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   308
                if 'external' + os.sep in os.path.abspath(str(prop.defaultValue)):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   309
                    items.append(str(prop.defaultValue))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   310
        if hasattr(proj, 'fileDependency'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   311
            for dep in proj.fileDependency:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   312
                dep = str(dep).split(' ')[0]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   313
                if 'external' + os.sep in os.path.abspath(str(dep)):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   314
                    items.append(str(dep))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   315
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   316
        items = set(items)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   317
        for i in items:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   318
            out.write('\"%s\" -> \"%s\"\n' % (str(proj.name), i.replace(os.environ['HELIUM_HOME'], 'helium').replace(os.sep, '/')))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   319
    out.write('}')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   320
    out.close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   321
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   322
def appendLogs(targ, proj, output, macro=False):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   323
    """append logs"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   324
    if hasattr(targ, 'signal'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   325
        for signal in targ.signal:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   326
            if macro:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   327
                output.append("\"%s\" [fontname=\"Times-Italic\"];" % str(targ.name))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   328
            output.append('subgraph \"cluster%s\" {label = \"%s\"; \"%s\"}\n' % (str(proj.name), str(proj.name), str(targ.name)))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   329
            splt = str(signal).split(',')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   330
            if len(splt) > 1:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   331
                if splt[1] == 'now':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   332
                    color = 'red'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   333
                elif splt[1] == 'defer':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   334
                    color = 'yellow'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   335
                else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   336
                    color = 'green'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   337
                output.append('subgraph \"cluster%s\" {color=%s;style=filled;label = \"Failbuild: %s\"; \"%s\"}\n' % (str(splt[1]), color, str(splt[1]), str(splt[0])))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   338
            output.append('\"%s\" -> \"%s\" [style=dotted]\n' % (str(targ.name), str(splt[0])))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   339
    if hasattr(targ, 'log'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   340
        for log in targ.log:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   341
            logdir = '/output/logs/'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   342
            logname = os.path.basename(str(log))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   343
            if not ('**' in logname):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   344
                logname = logname.replace('*', '${sysdef.configuration}').replace('--logfile=', '')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   345
                if not logdir in logname:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   346
                    logname = logdir + logname
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   347
                logname = logname.replace(os.sep, '/')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   348
                
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   349
                if macro:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   350
                    output.append("\"%s\" [fontname=\"Times-Italic\"];" % str(targ.name))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   351
                output.append('subgraph \"cluster%s\" {label = \"%s\"; \"%s\"}\n' % (str(proj.name), str(proj.name), str(targ.name)))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   352
                output.append('\"%s\" -> \"%s\"\n' % (str(targ.name), logname))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   353
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   354
def findLogFiles(database, output):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   355
    """find Log files"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   356
    out = open(output, 'w')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   357
    dbase = amara.parse(open(database))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   358
    out.write('digraph G {\n')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   359
    output = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   360
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   361
    root_objects = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   362
    for project in dbase.antDatabase.project:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   363
        root_objects.append(project)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   364
    for antlib in dbase.antDatabase.antlib:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   365
        root_objects.append(antlib)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   366
    for p_ro in root_objects:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   367
        if hasattr(p_ro, 'macro'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   368
            for t_targ in p_ro.macro:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   369
                appendLogs(t_targ, p_ro, output, True)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   370
        if hasattr(p_ro, 'target'):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   371
            for t_targ in p_ro.target:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   372
                appendLogs(t_targ, p_ro, output)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   373
    for l_list in set(output):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   374
        out.write(l_list)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   375
    out.write('}')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   376
    out.close()