Package gbp :: Package deb :: Module format :: Class DebianSourceFormat

[hide private]
[frames] | no frames]

# Class DebianSourceFormat

    object --+
             |
            DebianSourceFormat

Contents of debian/source/format

    >>> d = DebianSourceFormat("3.0 (quilt)")
    >>> d.type
    'quilt'
    >>> d.version
    '3.0'
    >>> d = DebianSourceFormat("3.0 (native)")
    >>> d.type
    'native'
    >>> d = DebianSourceFormat("1.0")
    >>> d.type
    >>> d.version
    '1.0'
    >>> d = DebianSourceFormat("1.0 broken")
    Traceback (most recent call last):
    ...
    DebianSourceFormatError: Cannot get source format from '1.0 broken'

Instance Methods | [hide private]

_parse(self, content) |

__init__(self, content) x.__init__(...) initializes x; see help(type(x)) for signature |

__str__(self) str(x) |

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Class Methods | [hide private]

DebianSourceFormat

    >>> import tempfile, os
    >>> with tempfile.NamedTemporaryFile(delete=False) as t:
    ...    t.write("3.0 (quilt)")
    >>> d = DebianSourceFormat.parse_file(t.name)
    >>> d.version
    '3.0'
    >>> d.type
    'quilt'
    >>> os.unlink(t.name)

parse_file(klass, filename) Parse debian/source/format file |

from_content(klass, version, type, format_file=None) Write a format file from type and format at format_file |

Class Variables | [hide private]

| format_file = ``'``debian/source/format``'``

Properties | [hide private]

| version The source format version number
| type The 'type' (e.g.
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, content)
(Constructor)

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### __str__(self)
(Informal representation operator)

str(x)

Overrides: object.__str__
  (inherited documentation)

### parse_file(klass, filename)
Class Method

Parse debian/source/format file

Parameters:
  - `filename` (`str`) - the file to parse
Returns: DebianSourceFormat

    >>> import tempfile, os
    >>> with tempfile.NamedTemporaryFile(delete=False) as t:
    ...    t.write("3.0 (quilt)")
    >>> d = DebianSourceFormat.parse_file(t.name)
    >>> d.version
    '3.0'
    >>> d.type
    'quilt'
    >>> os.unlink(t.name)

  a debisn/source/format object

### from_content(klass, version, type, format_file=None)
Class Method

Write a format file from type and format at format_file

Parameters:
  - `version` - the source package format version
  - `type` - the format type
  - `format_file` - the format file to create with the above parameters

Property Details | [hide private]

### version

The source format version number

Get Method:
  unreachable.version(self) - The source format version number

### type

The 'type' (e.g. git, native)

Get Method:
  unreachable.type(self) - The 'type' (e.g.