File: deb822.py

package info (click to toggle)
dh-cmake 0.6.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 392 kB
  • sloc: python: 2,252; perl: 26; makefile: 6; ansic: 6; sh: 2
file content (25 lines) | stat: -rw-r--r-- 701 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# This file is part of dh-cmake, and is distributed under the OSI-approved
# BSD 3-Clause license. See top-level LICENSE file or
# https://gitlab.kitware.com/debian/dh-cmake/blob/master/LICENSE for details.

import re

import debian.deb822


def read_control(sequence, *args, **kwargs):
    iterator = debian.deb822.Deb822.iter_paragraphs(sequence, *args, **kwargs)
    source = ControlSource(next(iterator).dump())
    packages = [ControlPackage(p.dump()) for p in iterator]

    return source, packages


class ControlSource(debian.deb822.Deb822):
    pass


class ControlPackage(debian.deb822.Deb822):
    @property
    def architecture(self):
        return re.split("\\s+", self["architecture"])