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 *
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()
53################################################################################
56def usage():
57 print("usage: dak write-sections")
58 sys.exit(0)
60################################################################################
63def main():
64 if len(sys.argv) != 1: 64 ↛ 67line 64 didn't jump to line 67, because the condition on line 64 was never false
65 usage()
67 session = DBConn().session()
68 write_sections(session)
70#########################################################################################
73if __name__ == '__main__':
74 main()
76# vim:set et:
77# vim:set ts=4:
78# vim:set shiftwidth=4: