%PDF- %PDF-
Direktori : /lib/python3/dist-packages/debian/__pycache__/ |
Current File : //lib/python3/dist-packages/debian/__pycache__/changelog.cpython-312.pyc |
� Cf�cg� � � � d Z ddlZddlZddlZddlZddlZ ddlZ ddl m Z mZmZm Z mZmZmZmZmZmZmZmZ eeeee ee ee f ZddlmZ ej4 d� Z G d� de� Z G d� d e� Z G d � de� Z G d� d e � Z! ejD dddiz ejF � Z$ ejD d� Z% ejD d� Z& ejD d� Z' ejD d� Z( ejD d� Z) ejD dejF � Z* ejD dejF � Z+ ejD dejF � Z, ejD dejF � Z- ejD dejF � Z. ejD d� Z/ ejD d� Z0 ejD d� Z1 ejD dejF � Z2 ejD dejF � Z3 ejD d � Z4 ejD d!� Z5 ejD d"ejF � Z6 ejD d#ejF � Z7 ejD d$ejF � Z8 ejD d%ejF � Z9 ejD d&ejF � Z: ejD d'� Z; G d(� d)e � Z<d*� Z=d,d+�Z>y# e$ r Y ���w xY w# e$ r Y ���w xY w)-a� Facilities for reading and writing Debian changelogs The aim of this module is to provide programmatic access to Debian changelogs to query and manipulate them. The format for the changelog is defined in `deb-changelog(5) <https://manpages.debian.org/stretch/dpkg-dev/deb-changelog.5.html>`_ Stability: The API is not marked as stable but hasn't changed incompatibly since 2007. Potential users of these classes are asked to work with the `python-debian` maintainers to improve, extend and stabilise this API. Overview ======== Create a changelog object using the constuctor. Pass it the contents of the file if there are some entries, or ``None`` to create an empty changelog:: >>> import debian.changelog >>> ch = debian.changelog.Changelog() >>> maintainer, email = 'John Doe', 'joe@example.com' >>> timestamp = 1617222715 >>> # You might want to use get_maintainer() a la: >>> # maintainer, email = debian.changelog.get_maintainer() >>> ch.new_block( ... package='example', ... version='0.1', ... distributions='unstable', ... urgency='low', ... author="%s <%s>" % (maintainer, email), ... # You can also omit timestamp, if you are fine with "now" ... # We use a hard-coded timestamp for deterministic output ... date=debian.changelog.format_date(timestamp=1617222715, localtime=False) ... ) >>> ch.add_change('') >>> ch.add_change(' * Some change') >>> ch.add_change('') >>> print(ch, end='') example (0.1) unstable; urgency=low <BLANKLINE> * Some change <BLANKLINE> -- John Doe <joe@example.com> Wed, 31 Mar 2021 20:31:55 -0000 If you have the full contents of a changelog, but are only interested in the most recent versions you can pass the ``max_blocks`` keyword parameter to the constuctor to limit the number of blocks of the changelog that will be parsed. If you are only interested in the most recent version of the package then pass ``max_blocks=1``:: >>> import gzip >>> from debian.changelog import Changelog >>> with gzip.open('/usr/share/doc/dpkg/changelog.Debian.gz') as fh: # doctest: +SKIP ... ch = Changelog(fh, max_blocks=1) >>> print(''' ... Package: %s ... Version: %s ... Urgency: %s''' % (ch.package, ch.version, ch.urgency)) # doctest: +SKIP Package: dpkg Version: 1.18.24 Urgency: medium See `/usr/share/doc/python-debian/examples/changelog/` or the `git repository <https://salsa.debian.org/python-debian-team/python-debian/tree/master/ examples/changelog>`_ for examples of usage. The :class:`Changelog` class is the key class within this module. Changelog Classes ----------------- � N)�Any�Dict�Iterable�Iterator�IO�List�Optional�Pattern�Union�Text�Tuple�TypeVar)�Versionzdebian.changelogc �, � � e Zd ZdZdZ� fd�Zd� Z� xZS )�ChangelogParseErrorz0Indicates that the changelog could not be parsedTc �8 �� || _ t t | � � y �N)�_line�superr �__init__)�self�line� __class__s ��2/usr/lib/python3/dist-packages/debian/changelog.pyr zChangelogParseError.__init__� s �� ��� � �!�4�1�3� c � � d| j z S )NzCould not parse changelog: )r �r s r �__str__zChangelogParseError.__str__� s � �,�T�Z�Z�7�7r ��__name__� __module__�__qualname__�__doc__� is_user_errorr r � __classcell__�r s @r r r � s �� �:��M�4� 8r r c � � e Zd ZdZy)�ChangelogCreateErrorz`Indicates that changelog could not be created, as all the information required was not givenN)r r! r"