File manager - Edit - /home/newsbmcs.com/public_html/static/img/logo/python3-debian.tar
Back
NEWS.Debian.gz 0000644 00000001052 15027513260 0007042 0 ustar 00 � ]�O��0��sl�m��+���� �P$$�{DN2Iܺ��6���촥"�Ա�o�f:L��i���Ҳ,��vE��*��)��m==�����ذ�L��&6� 7w��[N� 7��혂�WF�b���Ź�ZqPP+��48~�=Uܫ�r4*|99�E�Į_#O��U���<�*@�#�~+ֶ#E5lZv������J�>����H�x��>_<�2%���k�+R�����fT�oi���O�a�ݦ�C"�ΉC���84*0�Z'�&�-Or�4�>rr��mNO�7,�h���r����S�� ^�R�:m�l���CD� �8��n������01*8�%ssT]�����`B�}`�\�ι�c|�HR�����]A���+K:�LG.m0���*�y8���ɢ˺M��^/f����*�4jLS����yhYN��r�;�bF5y J�<@=t0��πO�1�bm����˷��_/����W��W�����a�����i�ۅ���#�/q�һ�|������aKw%��_���� README.rst 0000644 00000003343 15027513260 0006237 0 ustar 00 The `debian` Python modules work with Debian-related data formats, providing a means to read data from files involved in Debian packaging, and the distribution of Debian packages. The ability to create or edit the files is also available for some formats. Currently supported are: * Debtags information (:mod:`debian.debtags` module) * debian/changelog (:mod:`debian.changelog` module) * Packages files, pdiffs (:mod:`debian.debian_support` module) * Control files of single or multiple RFC822-style paragraphs, e.g. debian/control, .changes, .dsc, Packages, Sources, Release, etc. (:mod:`debian.deb822` module) * Raw .deb and .ar files, with (read-only) access to contained files and meta-information (:mod:`debian.debfile` module) `API documentation`_, can be found online and throughout the code. There are examples both within the code and in the examples_ directory. .. _API documentation: https://python-debian-team.pages.debian.net/python-debian/html/ .. _examples: https://salsa.debian.org/python-debian-team/python-debian/tree/master/examples Note that some modules can use `python-apt`_ to speed up processing. .. _python-apt: https://packages.debian.org/unstable/python3-apt Contributions to `python-debian` are most welcome, including expansion of the module's capabilities. If you have a module that is for manipulation or interrogation of Debian specific data then consider adding it to this package. Please discuss your ideas on the `mailing list`_, make merge requests via the `salsa repository`_, and see the :ref:`Contributing` section of this documentation. .. _mailing list: mailto:pkg-python-debian-maint@lists.alioth.debian.org .. _salsa repository: https://salsa.debian.org/python-debian-team/python-debian copyright 0000644 00000007632 15027513260 0006510 0 ustar 00 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: python-debian Upstream-Contact: pkg-python-debian-maint@lists.alioth.debian.org Source: https://salsa.debian.org/python-debian-team/python-debian Files: * Copyright: Debian python-debian Maintainers (see debian/control for maintainer names) License: GPL-2+ Files: lib/deb822.py lib/debian/deb822.py lib/debian/tests/test_deb822.py Copyright: Copyright (C) 2005-2006 dann frazier <dannf@dannf.org> Copyright (C) 2006-2010 John Wright <john@johnwright.org> Copyright (C) 2006 Adeodato Simó <dato@net.com.org.es> Copyright (C) 2008 Stefano Zacchiroli <zack@upsilon.cc> Copyright (C) 2014 Google, Inc. License: GPL-2+ Files: examples/changelog/* lib/debian/changelog.py setup.py lib/debian/tests/test_changelog.py Copyright: Copyright (C) 2006-2007 James Westby <jw+debian@jameswestby.net> Copyright (C) 2008 Canonical Ltd. License: GPL-2+ Comment: lib/debian/changelog.py's parsing code is based on that from dpkg which is: Copyright 1996 Ian Jackson Copyright 2005 Frank Lichtenheld <frank@lichtenheld.de> and licensed under the same license. Files: lib/debian/debian_support.py lib/debian/tests/test_debian_support.py Copyright: Copyright (C) 2005 Florian Weimer <fw@deneb.enyo.de> Copyright (C) 2006-2007 James Westby <jw+debian@jameswestby.net> Copyright (C) 2010 John Wright <jsw@debian.org> License: GPL-2+ Files: examples/debtags/* lib/debian/debtags.py lib/debian/doc-debtags lib/debian/tests/test_debtags.py Copyright: Copyright (C) 2003-2007 Enrico Zini <enrico@debian.org> License: GPL-3+ Files: examples/debfile/* lib/debian/arfile.py lib/debian/debfile.py lib/debian/tests/test_debfile.py Copyright: Copyright (C) 2007-2008 Stefano Zacchiroli <zack@debian.org> Copyright (C) 2007 Filippo Giunchedi <filippo@debian.org> License: GPL-3+ Files: lib/debian/deprecation.py Copyright: Copyright (C) Ben Finney <ben+debian@benfinney.id.au> License: GPL-2+ Files: examples/copyright/* lib/debian/copyright.py lib/debian/tests/test_copyright.py Copyright: Copyright (C) 2014 Google, Inc. License: GPL-2+ Files: lib/debian/_deb822_repro/* Copyright: Copyright (C) 2021 Niels Thykier <niels@thykier.net> License: GPL-2+ License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. . This program 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 for more details. . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. . On Debian systems, the complete text of the GNU General Public License version 2 can be found in `/usr/share/common-licenses/GPL-2'. License: GPL-3+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. . This program 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 for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. . On Debian systems, the complete text of the GNU General Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'. HISTORY.deb822 0000644 00000003754 15027513260 0006627 0 ustar 00 Following is the changelog for deb822 before it was merged into python-debian. deb822 (0.3) unstable; urgency=low * deb822.py: - Allow Deb822 objects to be initialized with a dict containing the initial key-value pairs. - _multivalued class: + Make all the multivalued dicts Deb822Dict objects, so the keys are case-preserving, but case-insensitive - Add a Release class, which knows about Release-file multivalued fields. Thanks to Alexandre Fayolle. (Closes: 428540) - Deb822Dict no longer directly subclasses dict. All of the important methods were already implemented with userdict.DictMixin; the dict subclass was so that Python would see a Deb822Dict instance as a dict instance. Unfortunately, this causes confusion if you do something like d = dict(Deb822Dict({'foo': 'bar'}) The "Pythonic" way to check for a dictionary interface is to check for the 'items' attribute. * test_deb822.py: - Add a test case for deriving a Python dict from a Deb822Dict. * debian/control: - Add a XS-Vcs-Bzr field -- John Wright <john@movingsucks.org> Tue, 12 Jun 2007 17:37:05 -0600 deb822 (0.2) unstable; urgency=low * debian/rules: - Tell setup.py not to compile the modules -- python-support does that at install time * README: - Fix a typo * debian/control: - Improve the description - Remove X[BS]-Python-Version fields, as per python-support README * deb822.py: - Add a get_pool_path() method to the Changes class which returns the path in the pool you would expect to find the files listed in the .changes file - Fix a typo in Deb822Dict.__init__ where I was referring to fields, not _fields * Remove debian/pycompat, as per python-support README -- John Wright <john@movingsucks.org> Fri, 5 Jan 2007 17:40:54 -0700 deb822 (0.1) unstable; urgency=low * Initial packaging (Closes: 380173) -- John Wright <john@movingsucks.org> Wed, 15 Nov 2006 17:00:32 -0700 changelog.gz 0000644 00000005711 15027513260 0007042 0 ustar 00 � �Y�r۶��S�ͅ�֢�?[V�N;i�6��?�ř�"!I� �e��z�G�y��-@R�-;Ig��D���~��n��MTމ�L��n0藳2�e7�<��߱R/D���D,���3ƾa�R����n�6���� d�ʊ-{��t̞wON�G��>6v:��!V��\�������?5���*�� �i�Y/�Yw4� ǃ�6��g��?P;U�Jg�'l�U���27��R�hz�~�.D�e.�`��|!�H�i3S�Җ͕f�ka��0㛫����p�mf����`�Q�n�L��i���Z|���(R���]�j�3�Rz� �&�T� ���ʔkƱ��<&�R�L� ��s�9�i�f0��� ��bs�且�ȥ� �,Q���Я r�~�x�r�Q9惈Xx�ވ9�Ǻ�q�x�;�c��:f���X�{'�Lh��йR�����uYY�,�F��t&y��1.1�"����F�Xk�Hl�^��aS�$R�VO�_�pc3e�����[�N%LNF�n�yǮ/~q^8�NX��2��\��/^���h��Y��=?9�}/��꒜d�3�;m��;a��s����ɬ���J�Y?:]2�3�0w�(�}\Ll\��M��)�W�����ǣ��~e�_aWî��R�<��[X`I�I,\j�ZFXw�-OK(��;,B����7���ič���c��K��N���w���͋�&}wQ �{�Ҹ?�x �^ �/��u��;D���8�_�}�}4�{O��W���O�R�=�~*e��Jq�O��k��؈�)|\�Z,��t�ה��3UZs�!��=J3�i�EH or6tl�Շ֓("h8�G����Iap� ��ĜG����Q��O�J+o�i���X.\j����<B��:��~�%�@A�Jwu�r���*���%�C����"J� L�Ƕz��\��ul:�W��ʃ�(ً\�5 ���Z�U@�6AI[ ��`����%""ME��פ,ƭ�rVڪx�q�y�<�| 4��D ��KoC� y��%e��� ��Vh/��Z�����䜕F�n��d\��Y)�_�8�2)jNQ�Ri2��np���pyVj�s.E.��?����ۇ�[��"U<�7}f�ܿW���-���.��Q��O��C�BK���݅n7�ε*0�aJ�h+�W(k%���p�{D,eᒼ���0^��}rS�o�L)y�����E�X�i(Ao*� 5h4+�"#��CҴQ��������Ns�~�`���)��3h� ��Y<�R/�6bM�0�~�n�=� s�x4J��Cep!�7��i��3�� ����K�`�NGX�Q^Y1Mf�2�� ����O�t���p�9G�̑�Nu�T��p�TF�?%{ _�;0u�oY�$�B���<��{p��q�@p) �^o�?��?������Oj2�d��,��!n�O�ʙ�s�2_�j�������i� �6�*�˟'�*E�������W���P�ե��|��{��_��7�������)�ER�N��O��-�#AFjN�!8OO�9jN�Q.� ���a<ϕ�[Ey�aP���gF��g2�v]�"��X�U�'"�A�Z�,A���Y��<_:�/��ߦr顜�Hp��k\���[#�^�%l\�s�$ٳ�ĭ���$.|�ܘR���2�6/�*vR�^p\�j���$ �2�� +"��Q�%���`*d�n�t�u��[�Ȗ3�O+S|i �ػ2�j�h��h������40�һ�s�����v!A(�b/9�����Y�JJ��vZ.�;��p<8a����>�,��{�tr� ���EM)]z��d��S�_w�C�̉G�2�5ψ#l?�JH���滋���!�p�#�M�8�$ �s�iً�Q�ߒ4:�ã����.ߞv;�Ȃ�s��7<�|>�i���4�����)��R�^�7�.�+��^�wM��@ E*:H��@��8��|N��c+�)D$�2�q��Y����R��\Ӝx�'�~ϕ#DPw���X��h����b���&Q%�L|N0�O5�f��Y"R��E!!�{���˚��D��uX}�q���ߔG�o L�#o���e��-��<�T�|f5�ԑh|Ss4z�C(���V��㦈���R�!C5#�T�X��]0S/��Y5��v�]M���F<j%Ҕ>_���o���Y�: {���&�h�A����jD�Írʜ{ҦfEd��|��`� p���S4,[�Ν��F�1 �̡��Ge�d�]"2�-~A@<6h���� �� jǒ���,U�B��&�q���M�kT�;�wan��߈��DZN*P`#~6#�����E�Oh~E >d��x�">�(�G�n��hu�ʱ���8���3���v�a�LE� �A�r���,��`sX�~Ӱkhh[���7�W7�=�l;�g�5��&���A����&q��*T��̛q��V�P\�ONd�&T�r 6*7&i�Rei��{�R��-����H��x�J�8���p�kB�%Eʱ5��z)����X����m\}�L.Խ9Bn��GC���D��RF�{r/�W�V;�?>:麕��Vchtt����:n�\�Ȭ��g�G�ЧgQ4�\�����\�ʤcň�J��z,���P�A���^� B��x���A���eВ��~�N�*�iEi�ꤋx}����������&�����Er{\��D� O oA|��3a��n�{�j�A?�\��}2� -:����r������3��n �������sm��vß�n�o/"eo�@ ����;N����{{�ro�<�w�iH6���Ay���*�[���g{��p�� &~���C�Ţ examples/debtags/tagsbyrelevance 0000644 00000003307 15027513260 0013100 0 ustar 00 #!/usr/bin/python3 # debtags - Implement package tags support for Debian # # Copyright (C) 2003--2006 Enrico Zini <enrico@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import sys import re from debian import debtags if len(sys.argv) < 2: print("Usage: %s tagdb [packagelist]" % (sys.argv[0]), file=sys.stderr) sys.exit(1) full = debtags.DB() # Read full database tag_filter = re.compile(r"^special::.+$|^.+::TODO$") full.read(open(sys.argv[1], "r"), lambda x: not tag_filter.match(x)) # Read the package list and create the subcollection input = len(sys.argv) > 2 and open(sys.argv[2],"r") or sys.stdin pkgs = set() for pkg in input: # Tolerate apt-cache search output as well pkg, none = pkg.rstrip("\n").split(' - ', 1) pkgs.add(pkg) sub = full.choose_packages(pkgs) rel_index = debtags.relevance_index_function(full, sub) # Get all the tags sorted by increasing relevance tags = sorted(sub.iter_tags(), lambda a, b: cmp(rel_index(a), rel_index(b))) ## And finally print them for tag in tags: print(tag) #print(tag, sub.card(tag), full.card(tag), float(sub.card(tag)) / float(full.card(tag))) examples/debtags/pkgwalk 0000755 00000010603 15027513260 0011362 0 ustar 00 #!/usr/bin/python3 # # Copyright (C) 2007 Enrico Zini <enrico@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Navigate among related Debian packages import sys # Requires python-extractor, python-magic and python-debtags from debian import debtags import re from optparse import OptionParser import apt VERSION="0.1" class Parser(OptionParser): def __init__(self, *args, **kwargs): OptionParser.__init__(self, *args, **kwargs) def error(self, msg): sys.stderr.write("%s: error: %s\n\n" % (self.get_prog_name(), msg)) self.print_help(sys.stderr) sys.exit(2) if __name__ == '__main__': parser = Parser(usage="usage: %prog [options] pkgname", version="%prog "+ VERSION, description="walk through Debian packages") parser.add_option("--tagdb", default="/var/lib/debtags/package-tags", help="Tag database to use (default: %default)") (options, args) = parser.parse_args() if len(args) == 0: parser.error("Please provide the name of an initial package") # Read full database db = debtags.DB() tag_filter = re.compile(r"^special::.+$|^.+::TODO$") db.read(open(options.tagdb, "r"), lambda x: not tag_filter.match(x)) apt_cache = apt.Cache() # Maximum number of previous packages to remember maxlen = 5 # Initial package selection trail = [ args[0] ] # Loop until the user chooses to quit done = False while not done: # Compute a package weight according to how old it is in the # trail pkgweight = {} for idx, pkg in enumerate(trail): pkgweight[pkg] = 1.-(idx/maxlen) # For every tag, find the number of packages in trail that have the tag tagscores = {} for pkg in trail: for tag in db.tags_of_package(pkg): if tag in tagscores: tagscores[tag] += pkgweight[pkg] else: tagscores[tag] = pkgweight[pkg] # Divide every tag score by the number of packages in the trail, # obtaining a 'tag weight'. A package can be later scored by summing # the weight of all its tags. for tag in tagscores: tagscores[tag] = float(tagscores[tag]) / float(len(trail)) # Find the merged tagset of the packages in trail trailtags = set(tagscores.keys()) # Get the list of packages whose tagsets intersect the trail tagset nextpkgs = set() for pkg, tags in db.iter_packages_tags(): if trailtags & tags: nextpkgs.add(pkg) # Score every package by the sum of the weight of its tags def pkgscore(pkg): score = 0.0 for tag in db.tags_of_package(pkg): if tag in tagscores: score += tagscores[tag] return score # Show the first 20 packages in reverse score order #display = sorted(nextpkgs - set(trail), key=pkgscore, reverse=True)[:20] display = sorted(nextpkgs, key=pkgscore, reverse=True)[:20] for num, pkg in enumerate(display): aptpkg = apt_cache[pkg] desc = aptpkg.raw_description.split("\n")[0] print("%2d) %s - %s" % (num + 1, pkg, desc)) # Ask the user to choose a new package while True: ans = input("> ").strip() if ans[0] == 'q': done = True break elif ans.isdigit(): num = int(ans) - 1 if num < len(display): # TODO: on a different kind of interface, display the full # description of pkg trail = [display[num]] + trail[:maxlen] break else: print("The number is too high") # vim:set ts=4 sw=4: examples/debtags/reverse 0000755 00000002304 15027513260 0011374 0 ustar 00 #!/usr/bin/python3 # debtags - Implement package tags support for Debian # # Copyright (C) 2003--2006 Enrico Zini <enrico@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import sys from debian import debtags input = sys.stdin if len(sys.argv) > 1: input = open(sys.argv[1],"r") #db = read_tag_database(input) #db = reverse(db) db = debtags.read_tag_database_reversed(input) #dummy, db = debtags.read_tag_database_both_ways(input) for pkg, tags in db.items(): # Using % here seems awkward to me, but if I use calls to # sys.stdout.write it becomes a bit slower print("%s:" % (pkg), ", ".join(tags)) examples/debtags/smartsearch 0000755 00000017145 15027513260 0012246 0 ustar 00 #!/usr/bin/python3 # debtags - Implement package tags support for Debian # # Copyright (C) 2003--2006 Enrico Zini <enrico@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import sys import re import subprocess from debian import debtags import apt class SmartSearcher: def __init__(self, fullcoll, query): self.apt_cache = apt.Cache() self.wanted = set() self.unwanted = set() self.ignored = set() self.interesting = [] self.tags_in_menu = [] self.fullcoll = fullcoll self.subcoll = fullcoll # Initialise the search self.compute_interesting(query) def compute_interesting(self, query): input = subprocess.Popen("apt-cache search " + query, shell=True, stdout = subprocess.PIPE, close_fds = True) # Read the package list and create the subcollection pkgs = [] for pkg in input.stdout: pkg, none = pkg.rstrip("\n").split(' - ', 1) #print(pkg) pkgs.append(pkg) subcoll = self.fullcoll.choose_packages(pkgs) rel_index = debtags.relevance_index_function(self.fullcoll, subcoll) # Get all the tags sorted by increasing relevance self.interesting = sorted(self.subcoll.iter_tags(), lambda b, a: cmp(rel_index(a), rel_index(b))) def tag_match(self, pkg): tags = self.fullcoll.tags_of_package(pkg) if len(self.wanted) > 0 and not self.wanted.issubset(tags): return False if len(self.unwanted) > 0 and len(tags.intersection(self.unwanted)) > 0: return False return True def refilter(self): # Regenerate subcoll self.subcoll = self.fullcoll.filter_packages(self.tag_match) def show_set(self, tags, type): for tag in tags: self.tags_in_menu.append(tag) print("%d) %s (%s)" % (len(self.tags_in_menu), tag, type)) def show_choice_sequence(self, seq, max = 7): for tag in seq: if tag in self.wanted or tag in self.unwanted or tag in self.ignored: continue self.tags_in_menu.append(tag) print("%d) %s (%d/%d)" % \ (len(self.tags_in_menu), tag, self.subcoll.card(tag), self.subcoll.package_count())) max = max - 1 if max == 0: break def show_tags(self): self.tags_in_menu = [] self.show_set(self.wanted, "wanted") self.show_set(self.unwanted, "unwanted") self.show_set(self.ignored, "ignored") print self.show_choice_sequence(self.interesting) print # Compute the most interesting tags by discriminance discr = sorted(self.subcoll.iter_tags(), \ lambda a, b: cmp(self.subcoll.discriminance(a), self.subcoll.discriminance(b))) self.show_choice_sequence(discr) def output_packages(self): for pkg in self.subcoll.iter_packages(): aptpkg = self.apt_cache[pkg] desc = aptpkg.raw_description.split("\n")[0] print(pkg, "-", desc) def interact(self): done = False while not done: print("Tag selection:") self.show_tags() print(self.subcoll.package_count(), " packages selected so far.") changed = False sys.stdout.write("Your choice (+#, -#, =#, K word, View, Done, Quit, ?): ") ans = sys.stdin.readline() if ans == None: break ans = ans.strip(" \t\n") # If we're setting a new keyword search, process now and skip # processing as a list if ans == "?": print("+ number select the tag with the given number as a tag you want") print("- number select the tag with the given number as a tag you do not want") print("= number select the tag with the given number as a tag you don't care about") print("K word recompute the set of interesting tags from a full-text search using the given word") print("V view the packages selected so far") print("D print the packages selected so far and exit") print("Q quit debtags smart search") print("? print this help information") elif ans[0] == 'k' or ans[0] == 'K': # Strip initial command and empty spaces ans = ans[1:].strip(); if len(ans) == 0: print("The 'k' command needs a keyword to use for finding new interesting tags.") else: self.compute_interesting(ans) ans = '' else: # Split the answer by spaces for cmd in ans.split(): if cmd[0] == '+' or cmd[0] == '-' or cmd[0] == '=': try: idx = int(cmd[1:]) except ValueError: print(cmd, "should have a number after +, - or =") continue if idx > len(self.tags_in_menu): print("Tag", idx, "was not on the menu.") else: tag = self.tags_in_menu[idx - 1] # cout << "Understood " << ans << " as " << ans[0] << tag.fullname() << endl; if cmd[0] == '+': self.wanted.add(tag) if tag in self.unwanted: self.unwanted.remove(tag) if tag in self.ignored: self.ignored.remove(tag) if cmd[0] == '-': if tag in self.wanted: self.wanted.remove(tag) self.unwanted.add(tag) if tag in self.ignored: self.ignored.remove(tag) if cmd[0] == '=': if tag in self.wanted: self.wanted.remove(tag) if tag in self.unwanted: self.unwanted.remove(tag) self.ignored.add(tag) changed = True elif cmd == "V" or cmd == "v": self.output_packages() elif cmd == "D" or cmd == "d": self.output_packages() done = True; elif cmd == "Q" or cmd == "q": done = True; else: print("Ignoring command \"%s\"" % (cmd)) if changed: self.refilter() if len(sys.argv) < 3: print("Usage: %s tagdb keywords..." % (sys.argv[0]), file=sys.stderr) sys.exit(1) # Main starts fullcoll = debtags.DB() # Read full database tag_filter = re.compile(r"^special::.+$|^.+::TODO$") fullcoll.read(open(sys.argv[1], "r"), lambda x: not tag_filter.match(x)) searcher = SmartSearcher(fullcoll, " ".join(sys.argv[2:])) searcher.interact() # vim:set ts=4 sw=4 expandtab: examples/debtags/tagminer 0000755 00000015231 15027513260 0011532 0 ustar 00 #!/usr/bin/python3 # # Copyright (C) 2007 Enrico Zini <enrico@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Given a file, search Debian packages that can somehow handle it import sys # Requires python-extractor, python-magic and python-debtags import extractor import magic from debian import debtags import re from optparse import OptionParser import apt VERSION="0.1" mime_map = ( ( r'text/html\b', ("works-with::text","works-with-format::html") ), ( r'text/plain\b', ("works-with::text","works-with-format::plaintext") ), ( r'text/troff\b', ("works-with::text", "works-with-format::man") ), ( r'image/', ("works-with::image",) ), ( r'image/jpeg\b', ("works-with::image:raster","works-with-format::jpg") ), ( r'image/png\b', ("works-with::image:raster","works-with-format::png") ), ( r'application/pdf\b', ("works-with::text","works-with-format::pdf")), ( r'application/postscript\b', ("works-with::text","works-with-format::postscript")), ( r'application/x-iso9660\b', ('works-with-format::iso9660',)), ( r'application/zip\b', ('works-with::archive', 'works-with-format::zip')), ( r'application/x-tar\b', ('works-with::archive', 'works-with-format::tar')), ( r'audio/', ("works-with::audio",) ), ( r'audio/mpeg\b', ("works-with-format::mp3",) ), ( r'audio/x-wav\b', ("works-with-format::wav",) ), ( r'message/rfc822\b', ("works-with::mail",) ), ( r'video/', ("works-with::video",)), ( r'application/x-debian-package\b', ("works-with::software:package",)), ( r'application/vnd.oasis.opendocument.text\b', ("works-with::text",)), ( r'application/vnd.oasis.opendocument.graphics\b', ("works-with::image:vector",)), ( r'application/vnd.oasis.opendocument.spreadsheet\b', ("works-with::spreadsheet",)), ( r'application/vnd.sun.xml.base\b', ("works-with::db",)), ( r'application/rtf\b', ("works-with::text",)), ( r'application/x-dbm\b', ("works-with::db",)), # How do we tell these two apart? # ( 'application/ogg', ('works-with-format::oggvorbis',)), # ( 'application/ogg', ('works-with-format::oggtheora',)), # Missing tags # ( 'application/vnd.oasis.opendocument.presentation', ), # Still unhandled/unhandlable: # works-with::3dmodel - 3D Model # works-with::dictionary - Dictionaries # works-with::dtp - Desktop Publishing (DTP) # works-with::fax - Faxes # works-with::file - Files # works-with::font - Fonts # works-with::logfile - System Logs # works-with::music-notation - Music Notation # works-with::people - People # works-with::pim - Personal Information # works-with::software:source - Source code # works-with::spreadsheet - Spreadsheet # works-with::text - Text # works-with::unicode - Unicode # works-with-format::docbook - Docbook # works-with-format::info - Documentation in Info format # works-with-format::ldif - LDIF # works-with-format::sgml - SGML, Standard Generalized Markup Language # works-with-format::svg - SVG, Scalable Vector Graphics # works-with-format::tex - TeX, LaTeX and DVI # works-with-format::vrml - VRML 3D Model # works-with-format::xml - XML # works-with-format::xml:rss - RSS Rich Site Summary # works-with-format::xml:xslt - XSL Transformations (XSLT) ) extractor = extractor.Extractor() magic = magic.open(magic.MAGIC_MIME) magic.load() def mimetype(fname): keys = extractor.extract(fname) xkeys = {} for k, v in keys: if k in xkeys: xkeys[k].append(v) else: xkeys[k] = [v] namemagic = magic.file(fname) contentmagic = magic.buffer(open(fname, "r").read(4096)) return "mimetype" in xkeys and xkeys['mimetype'][0] or contentmagic or namemagic class Parser(OptionParser): def __init__(self, *args, **kwargs): OptionParser.__init__(self, *args, **kwargs) def error(self, msg): sys.stderr.write("%s: error: %s\n\n" % (self._get_prog_name(), msg)) self.print_help(sys.stderr) sys.exit(2) if __name__ == '__main__': parser = Parser(usage="usage: %prog [options] filename", version="%prog "+ VERSION, description="search Debian packages that can handle a given file") parser.add_option("--tagdb", default="/var/lib/debtags/package-tags", help="Tag database to use (default: %default)") parser.add_option("--action", default=None, help="Show the packages that allow the given action on the file (default: %default)") (options, args) = parser.parse_args() if len(args) == 0: parser.error("Please provide the name of a file to scan") # Read full database fullcoll = debtags.DB() tag_filter = re.compile(r"^special::.+$|^.+::TODO$") fullcoll.read(open(options.tagdb, "r"), lambda x: not tag_filter.match(x)) type = mimetype(args[0]) #print("Mime type:", type, file=sys.stderr) found = set() for match, tags in mime_map: match = re.compile(match) if match.match(type): for t in tags: found.add(t) if len(found) == 0: print("Unhandled mime type:", type, file=sys.stderr) else: if options.action != None: apt_cache = apt.Cache() query = found.copy() query.add("role::program") query.add("use::"+options.action) print("Debtags query:", " && ".join(query)) subcoll = fullcoll.filter_packages_tags(lambda pt: query.issubset(pt[1])) for i in subcoll.iter_packages(): aptpkg = apt_cache[i] desc = aptpkg.raw_description.split("\n")[0] print(i, "-", desc) else: print("Debtags query:", " && ".join(found)) query = found.copy() query.add("role::program") subcoll = fullcoll.filter_packages_tags(lambda pt: query.issubset(pt[1])) uses = map(lambda x:x[5:], filter(lambda x:x.startswith("use::"), subcoll.iter_tags())) print("Available actions:", ", ".join(uses)) # vim:set ts=4 sw=4: examples/copyright/check_parse_and_dump.py 0000755 00000010143 15027513260 0015065 0 ustar 00 #!/usr/bin/python3 # vim: fileencoding=utf-8 # # Copyright (C) 2014 Google, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, either version 2 # of the License, or (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. """Check the format and dumpability of debian/copyright filenames on stdin. Usage: find /tmp/packages -type f -name copyright | ./check_parse_and_dump.py The --suppress_warnings and --summary flags can be used to make the program output less verbose. """ import argparse import codecs import io import sys import warnings from debian import copyright def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--summary', action='store_true', help='Whether to print only a summary') parser.add_argument('--suppress_warnings', action='store_true', help='Whether to suppress copyright warnings') return parser.parse_args() def main(): args = parse_args() if args.suppress_warnings: warnings.filterwarnings('ignore', module='debian.copyright') problems = {} parse_failures = [] dump_failures = [] total = 0 for filename in sys.stdin: total += 1 filename = filename.rstrip() with io.open(filename, mode='rt', encoding='utf-8') as f: try: c = copyright.Copyright(f) except Exception as e: problems.setdefault((1, 'Parse failures'), []).append( (filename, e)) continue try: c.dump() except Exception as e: problems.setdefault((2, 'Dump failures'), []).append( (filename, e)) if not c.header.known_format(): problems.setdefault((3, 'Unknown format'), []).append( (filename, c.header.format)) invalid_globs = [] globs_with_leading_dot_slash = [] globs_with_trailing_comma = [] globs_with_double_star = [] for p in c.all_files_paragraphs(): try: p.files_pattern() except Exception as e: invalid_globs.append(e) for glob in p.files: if glob.startswith('./'): globs_with_leading_dot_slash.append(glob) if glob.endswith(','): globs_with_trailing_comma.append(glob) if '**' in glob: globs_with_double_star.append(glob) if invalid_globs: problems.setdefault((4, 'Invalid glob'), []).append( (filename, invalid_globs)) if globs_with_leading_dot_slash: problems.setdefault((5, 'Globs with leading ./'), []).append( (filename, globs_with_leading_dot_slash)) if globs_with_trailing_comma: problems.setdefault((6, 'Globs with trailing ,'), []).append( (filename, globs_with_trailing_comma)) if globs_with_double_star: problems.setdefault((7, 'Globs with **'), []).append( (filename, globs_with_double_star)) f = codecs.getwriter(encoding='utf-8')(sys.stdout) for (_, heading), problems in sorted(problems.items()): f.write('\n%s: (%d / %d)\n' % (heading, len(problems), total)) if not args.summary: for filename, problem in problems: f.write(' %s: %s\n' % (filename, problem)) if __name__ == '__main__': main() examples/deb822/render-dctrl 0000755 00000012546 15027513260 0011674 0 ustar 00 #!/usr/bin/python3 # render-dctrl # Copyright (C) 2009 Stefano Zacchiroli <zack@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # Requirements (Debian packages): python-debian python-markdown usage = """Usage: render-dctrl [OPTION ...] [FILE ...] Render a 822-like listing of Debian packages (AKA "Packages" file) to XHTML, rendering (long) descriptions as Markdown text. Render text coming from FILEs, if given, or from standard input otherwise. Typical usage is within a dctrl-tools pipeline, example: grep-available -s Package,Depends,Description ocaml | render-dctrl > foo.html Warning: beware of #525525 and thus avoid using "-s Description" alone.""" import re import string import sys from debian import deb822 from markdown import markdown from optparse import OptionParser options = None # global, for cmdline options css = """ body { font-family: sans-serif; } dt { font-weight: bold; } dd { margin-bottom: 5pt; } div.package { border: solid 1pt; margin-top: 10pt; padding-left: 2pt; padding-right: 2pt; } .raw { font-family: monospace; background: #ddd; padding-left: 2pt; padding-right: 2pt; } .shortdesc { text-decoration: underline; margin-bottom: 5pt; display: block; } .longdesc { background: #eee; } span.package { font-family: monospace; font-size: 110%; } .uid { float: right; font-size: x-small; padding-right: 10pt; } """ html_header = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css">%s</style> </head> <body> """ % css html_trailer = """ </body> </html> """ mdwn_list_line = re.compile(r'^(\s*)[\*\+\-]') # Markdown list item line # mdwn_head_line = re.compile(r'^(\s*)#') # Markdown header padding = re.compile(r'^(\s*)') def get_indent(s): m = padding.match(s) if m: return len(m.group(1)) else: return 0 def render_longdesc(lines): print('<div class="longdesc">') lines = map(lambda s: s[1:], lines) # strip 822 heading space curpara, paragraphs = [], [] inlist, listindent = False, 0 store_para = lambda: paragraphs.append(string.join(curpara, '\n') + '\n') add_indent = lambda n, s: string.expandtabs('\t', n) + s for l in lines: # recognize Markdown paragraphs if l.rstrip() == '.': # RULE 1: split paragraphs at Debian's "." store_para() curpara, inlist, listindent = [], False, 0 else: if inlist: # currently in a list if get_indent(l) <= listindent: # RULE 3: leave list on underflow store_para() curpara, inlinst, linstindent = [l], False, 0 else: # the list goes on ... curpara.append(l) else: # currently not in a list if mdwn_list_line.match(l): # new list start if curpara: # RULE 2: handle list item *not* at para start store_para() curpara, inlist, listindent = [l], True, get_indent(l) elif get_indent(l) >= 1: # RULE 4: hande non-list verbatim if curpara and get_indent(curpara[-1]) < 4: store_para() curpara = [] curpara.append(add_indent(3, l)) else: curpara.append(l) if curpara: store_para() for p in paragraphs: # render paragraphs print(markdown(p)) print('</div>') def render_field(field, val): field = field.lower() print('<dt>%s</dt>' % field) print('<dd class="%s">' % field) if field == 'description': lines = val.split('\n') print('<span class="shortdesc">%s</span>' % lines[0]) render_longdesc(lines[1:]) elif field == 'package': print('<a href="#%s" class="uid">id</a>' % val) print('<span id="%s" class="package">%s</span>' % (val, val)) elif field in []: # fields not to be typeset as "raw" print('<span class="%s">%s</span>' % (field, val)) else: print('<span class="raw">%s</span>' % val) print('</dd>') def render_file(f): global options, html_header, html_trailer if options.print_header: print(html_header) for pkg in deb822.Packages.iter_paragraphs(f): print('<div class="package">') print('<dl class="fields">') for (field, val) in pkg.items(): render_field(field, val) print('</dl>') print('</div>\n') if options.print_header: print(html_trailer) def main(): global options, usage parser = OptionParser(usage=usage) parser.add_option("-n", "--no-headers", action="store_false", dest="print_header", default=True, help="suppress printing of HTML header/trailer") (options, args) = parser.parse_args() if len(args): for fname in args: render_file(open(fname)) else: render_file(sys.stdin) if __name__ == '__main__': main() examples/deb822/grep_native_packages.py 0000755 00000001323 15027513260 0014066 0 ustar 00 #!/usr/bin/python3 # grep the names of all Debian native packages out of Sources files # Copyright (C) 2007 Stefano Zacchiroli <zack@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. import sys from debian import deb822 if __name__ == '__main__': for fname in sys.argv[1:]: with open(fname) as f: for stanza in deb822.Sources.iter_paragraphs(f): pieces = stanza['version'].split('-') if len(pieces) < 2: print(stanza['package']) examples/deb822/grep-maintainer 0000755 00000001542 15027513260 0012363 0 ustar 00 #!/usr/bin/python3 # grep-maintainer # Copyright (C) 2007 Stefano Zacchiroli <zack@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. """Dumb maintainer-based grep for the dpkg status file.""" import re import sys from debian import deb822 try: maint_RE = re.compile(sys.argv[1]) except IndexError: print("Usage: grep-maintainer REGEXP", file=sys.stderr) sys.exit(1) except re.error as e: print("Error in the regexp: %s" % (e,), file=sys.stderr) sys.exit(1) for pkg in deb822.Packages.iter_paragraphs(open('/var/lib/dpkg/status')): if 'Maintainer' in pkg and maint_RE.search(pkg['maintainer']): print(pkg['package']) examples/deb822/depgraph 0000755 00000003624 15027513260 0011076 0 ustar 00 #!/usr/bin/python3 # depgraph # Copyright (C) 2008 Stefano Zacchiroli <zack@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. """Graph the dependencies of all packages contained in a given Packages file. Only consider Depends fields. Versioned dependencies are considered as they were not versioned. The graph is returned in output as a (non normalized) graphviz graph suitable to be processed by dot (for an unstable/main Packages file, generating the final graph will take a while ...).""" import sys from debian import deb822 __fresh_id = 0 def main(): if len(sys.argv) != 2: print("Usage: depgraph PACKAGES_FILE") sys.exit(2) def get_id(): global __fresh_id __fresh_id += 1 return ("NODE_%d" % __fresh_id) def emit_arc(node1, node2): print(' "%s" -> "%s" ;' % (node1, node2)) def emit_node(node, dsc): print(' "%s" [label="%s"] ;' % (node, dsc)) print("digraph depgraph {") for pkg in deb822.Packages.iter_paragraphs(open(sys.argv[1])): name = pkg['package'] rels = pkg.relations for deps in rels['depends']: if len(deps) == 1: emit_arc(name, deps[0]['name']) else: # output an OR node or_node = get_id() emit_arc(name, or_node) emit_node(or_node, 'OR') for dep in deps: emit_arc(or_node, dep['name'].lower()) # even though it is forbidden by policy, there are some # dependencies with upper case letter in the archive, # apparently apt-get turn them to lowercase ... print("}") if __name__ == '__main__': main() examples/debfile/extract_cron 0000755 00000002303 15027513260 0012374 0 ustar 00 #!/usr/bin/python3 # extract_cron - extract cron-related files from .deb s # Copyright (C) 2007 Stefano Zacchiroli <zack@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. """Extracts all cron-related files from a (list of) .deb package(s).""" import os import re import sys from debian import debfile def is_cron(fname): return re.match(r'^etc/cron\.(d|daily|hourly|monthly|weekly)\b', fname) if __name__ == '__main__': if not sys.argv[1:]: print("Usage: extract_cron DEB ...") sys.exit(1) for fname in sys.argv[1:]: deb = debfile.DebFile(fname) cron_files = filter(is_cron, list(deb.data)) for cron_file in cron_files: print('Extracting cron-related file %s ...' % cron_file) path = os.path.join('.', cron_file) dir = os.path.dirname(path) if not os.path.exists(dir): os.mkdir(dir) with open(path, 'w') as out: out.write(deb.data.get_content(cron_file)) examples/debfile/ar 0000755 00000002434 15027513260 0010310 0 ustar 00 #!/usr/bin/python3 # ar.py: ar emulation using ArFile # Copyright (C) 2007 Filippo Giunchedi <filippo@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os import sys from debian import arfile if __name__ == '__main__': if len(sys.argv) < 3: print("usage: ar [tp] <arfile>") sys.exit(1) if not os.path.exists(sys.argv[2]): print("please provide a file to operate on") sys.exit(1) a = arfile.ArFile(sys.argv[2]) if sys.argv[1] == 't': print("\n".join(a.getnames())) elif sys.argv[1] == 'p': for m in a.getmembers(): #print("".join(m.readlines())) sys.stdout.write("".join(m.readlines())) examples/debfile/changelog_head 0000755 00000001706 15027513260 0012617 0 ustar 00 #!/usr/bin/python3 # changelog_head - head like tool for .deb changelog entries # Copyright (C) 2007 Stefano Zacchiroli <zack@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. """Like "head" for changelog entries, return last n-th entries of the changelog shipped in a .deb file.""" import sys from debian import debfile if __name__ == '__main__': if len(sys.argv) > 3 or len(sys.argv) < 2: print("Usage: changelog_head DEB [ENTRIES]") print(" ENTRIES defaults to 10") sys.exit(1) entries = 10 try: entries = int(sys.argv[2]) except IndexError: pass deb = debfile.DebFile(sys.argv[1]) chg = deb.changelog() entries = chg._blocks[:entries] print(''.join(map(str, entries))) examples/debfile/dpkg-info 0000755 00000003366 15027513260 0011571 0 ustar 00 #!/usr/bin/python3 # dpkg-info - DebFile's implementation of "dpkg --info" # Copyright (C) 2007 Stefano Zacchiroli <zack@debian.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. """ (An approximation of) a 'dpkg --info' implementation relying on DebFile class. """ import os import stat import sys from debian import debfile if __name__ == '__main__': if len(sys.argv) != 2: print("Usage: dpkg-info DEB") sys.exit(1) fname = sys.argv[1] deb = debfile.DebFile(fname) if deb.version == '2.0': print(' new debian package, version %s.' % deb.version) print(' size %d bytes: control archive= %d bytes.' % ( os.stat(fname)[stat.ST_SIZE], deb['control.tar.gz'].size)) for fname in deb.control: # print info about control part contents content = deb.control[fname] if not content: continue lines = content.split('\n') ftype = '' try: if lines[0].startswith('#!'): ftype = lines[0].split()[0] except IndexError: pass print(' %d bytes, %d lines, %s, %s' % (len(content), len(lines), fname, ftype)) for n, v in deb.debcontrol().items(): # print DEBIAN/control fields if n.lower() == 'description': # increase indentation of long dsc lines = v.split('\n') short_dsc = lines[0] long_dsc = '\n'.join(map(lambda l: ' ' + l, lines[1:])) print(' %s: %s\n%s' % (n, short_dsc, long_dsc)) else: print(' %s: %s' % (n, v)) examples/changelog/changelog_to_file 0000755 00000003014 15027513260 0013666 0 ustar 00 #!/usr/bin/python3 # changelog_to_file -- An example of outputting to changelog to a file. # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from debian.changelog import Changelog, Version import sys changelog = Changelog() changelog.new_block(package='python-debian', version=Version('0.1'), distributions='unstable', urgency='low', author='James Westby <jw+debian@jameswestby.net>', date='Thu, 3 Aug 2006 19:16:22 +0100', ) changelog.add_change(''); changelog.add_change(' * Welcome to changelog.py'); changelog.add_change(''); try: filename = sys.argv[1] except IndexError: print("Usage: "+sys.argv[0]+" filename") sys.exit(1) with open(filename, 'w') as f: changelog.write_to_open_file(f) examples/changelog/simple_changelog 0000755 00000002553 15027513260 0013545 0 ustar 00 #!/usr/bin/python3 # simple_changelog - A simple example of how to use the changelog.py module. # Copyright (C) 2006 James Westby <jw+debian@jameswestby.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from debian.changelog import Changelog, Version changelog = Changelog() changelog.new_block(package='python-debian', version=Version('0.1'), distributions='unstable', urgency='low', author='James Westby <jw+debian@jameswestby.net>', date='Thu, 3 Aug 2006 19:16:22 +0100', ) changelog.add_change(''); changelog.add_change(' * Welcome to changelog.py'); changelog.add_change(''); print(changelog)
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings