diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-02-14 22:25:39 +0000 |
---|---|---|
committer | Tarmac <Unknown> | 2013-02-14 22:25:39 +0000 |
commit | d05835eae4e47417fdd41a1d4fcaf6a2bcfd96ea (patch) | |
tree | 43995c9938a1039e251512d6f9ed71971b27a476 /trim-lcov.py | |
parent | e7966480ecd14bd6cb4c4ec5f527cfe10a1a0b0f (diff) | |
parent | 40d7c42d5212dc97ce6b07f05828fb62440d0694 (diff) | |
download | libayatana-indicator-d05835eae4e47417fdd41a1d4fcaf6a2bcfd96ea.tar.gz libayatana-indicator-d05835eae4e47417fdd41a1d4fcaf6a2bcfd96ea.tar.bz2 libayatana-indicator-d05835eae4e47417fdd41a1d4fcaf6a2bcfd96ea.zip |
Add IndicatorNg.
IndicatorNg is an indicator object that reads an indicator service file and watches the bus for a corresponding service to appear. It turns the menus and actions exported by the service into an indicator entry. I think this is a good solution for the transition period in which we support both styles of indicators. (It means we don't need to copy templates around.)
An indicator service file must have an ".indicator" extension and contents simlilar to this:
[Indicator Service]
Name=indicator-test
BusName=com.canonical.indicator.test
ObjectPath=/com/canonical/indicator/test
For unity-panel-service, these files will be installed somewhere. The indicator-loader in this branch accepts a path to such a file as the first command line argument (instead of the .so file).
This can be tested with the example indicator in lp:~larsu/libunity/add-indicator (examples/indicator.vala).
Approved by Charles Kerr, Ted Gould.
Diffstat (limited to 'trim-lcov.py')
-rwxr-xr-x | trim-lcov.py | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/trim-lcov.py b/trim-lcov.py new file mode 100755 index 0000000..8465e95 --- /dev/null +++ b/trim-lcov.py @@ -0,0 +1,69 @@ +#!/usr/bin/python + +# Copyright 2013 Canonical Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License version 3.0 for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library. If not, see +# <http://www.gnu.org/licenses/>. +# +# Author: Ryan Lortie <desrt@desrt.ca> + + +# This script removes branch and/or line coverage data for lines that +# contain a particular substring. +# +# In the interest of "fairness" it removes all branch or coverage data +# when a match is found -- not just negative data. It is therefore +# likely that running this script will actually reduce the total number +# of lines and branches that are marked as covered (in absolute terms). +# +# This script intentionally avoids checking for errors. Any exceptions +# will trigger make to fail. + +import sys + +line_suppress = ['g_assert_not_reached'] +branch_suppress = ['g_assert', 'g_return_if_fail', 'g_return_val_if_fail', 'G_DEFINE_TYPE'] + +def check_suppress(suppressions, source, data): + line, _, rest = data.partition(',') + line = int(line) - 1 + + assert line < len(source) + + for suppression in suppressions: + if suppression in source[line]: + return True + + return False + +source = [] +for line in sys.stdin: + line = line[:-1] + + keyword, _, rest = line.partition(':') + + # Source file + if keyword == 'SF': + source = file(rest).readlines() + + # Branch coverage data + elif keyword == 'BRDA': + if check_suppress(branch_suppress, source, rest): + continue + + # Line coverage data + elif keyword == 'DA': + if check_suppress(line_suppress, source, rest): + continue + + print line |