1#! /usr/bin/env python3
3"""
4Writes out a rfc2822-formatted list of sections and their descriptions.
6@contact: Debian FTP Master <ftpmaster@debian.org>
7@copyright: 2009 Peter Palfrader <peter@palfrader.org>
8@copyright: 2020 Joerg Jaspert <joerg@debian.org>
9@license: GNU General Public License version 2 or later
10"""
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27################################################################################
29import sys
31from daklib.dbconn import DBConn
33################################################################################
36def write_sections(session):
37 query_sections = """
38 SELECT
39 section,
40 description,
41 longdesc
42 FROM section
43 ORDER BY section
44 """
46 for row in session.execute(query_sections).fetchall():
47 (section, description, longdesc) = row
48 print("Section: {0}".format(section))
49 print("Description: {0}".format(description))
50 print("Longdesc: {0}".format(longdesc))
51 print()
54################################################################################
57def usage():
58 print("usage: dak write-sections")
59 sys.exit(0)
62################################################################################
65def main():
66 if len(sys.argv) != 1: 66 ↛ 69line 66 didn't jump to line 69, because the condition on line 66 was never false
67 usage()
69 session = DBConn().session()
70 write_sections(session)
73#########################################################################################
76if __name__ == "__main__":
77 main()
79# vim:set et:
80# vim:set ts=4:
81# vim:set shiftwidth=4: