Nokia Networks Home

Nokia nmake Product Builder

Quick Links

Related Products

Tool Repository

[ tool index ]

targets.py

Lists information about the triggered targets.

Download targets.py

Description

targets.py is a Python script that lists data about each triggered target. Data about each target appears on a separate output line in a space separated format. Each line displays target name, execution exit code, start time, and end time. This is a Python implementation of the targets example from the Build Log Overview.

Requirements

Python 2.6 (exptools users can use /opt/exp/python/python2.6/bin/python)

Usage

python targets.py filename.xml

Example Command Line

python targets.py makelog.xml

Example Output

See the Extended Example in the Build Log Overview for details and structure of the example build used.

cmd 0 16:11:44.84 16:11:49.03
hw 0 16:11:45.31 16:11:48.71
hw.o 0 16:11:45.97 16:11:46.66
hw 0 16:11:46.86 16:11:47.86
../../../bin 0 16:11:48.05 16:11:48.11
../../../bin/hw 0 16:11:48.28 16:11:48.38

Script

The XML document is parsed and stored in the tree variable. Then for each tg element the nm, ec, st and et attributes are printed. The [11:22] subscription is a "slice" of a sequence, in this case a string that returns the substring from index 11 through 21.

#! /usr/bin/env python
import sys
import xml.etree.cElementTree as ET
tree = ET.parse(sys.argv[1])
for tg in tree.findall("//tg"):
    print tg.get("nm"), tg.get("ec"), tg.get("st")[11:22], tg.get("et")[11:22]
Last Update: Friday,12-Aug-2016 12:17:03 EDT