File: python.rst

package info (click to toggle)
dose3 7.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,276 kB
  • sloc: ml: 25,053; python: 605; perl: 391; sh: 347; makefile: 187
file content (23 lines) | stat: -rw-r--r-- 834 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

Python tutorial
~~~~~~~~~~~~~~~

Distcheck output can be easily parsed from a Python program by using the
YAML parser (needs the Debian package python-yaml).

Example: If you have run debcheck with the option -f (and possibly with
the -s option in addition) you may obtain a report containing one non-
installable package (name and version) per line like this:

::

   import yaml
   doc = yaml.load(file(’output-of-distcheck’, ’r’))
   if doc[’report’] is not None:
     for p in doc[’report’]:
       if p[’status’] == ’broken’:
         print ’%s %s is broken’ (p[’package’], p[’version’])

A complete example of a python script that constructs a set of pseudo-
packages, runs dose-debcheck on it, and then processes the output is
given in the directory doc/examples/potential-file-overwrites.