Package dak :: Module write_sections
[hide private]
[frames] | no frames]

Source Code for Module dak.write_sections

 1  #! /usr/bin/env python3 
 2   
 3  """ 
 4  Writes out a rfc2822-formatted list of sections and their descriptions. 
 5   
 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  """ 
11   
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 
25   
26   
27  ################################################################################ 
28   
29  import sys 
30   
31  from daklib.dbconn import * 
32   
33  ################################################################################ 
34   
35   
36 -def write_sections(session):
37 query_sections = """ 38 SELECT 39 section, 40 description, 41 longdesc 42 FROM section 43 ORDER BY section 44 """ 45 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()
52 53 ################################################################################ 54 55
56 -def usage():
57 print("usage: dak write-sections") 58 sys.exit(0)
59 60 ################################################################################ 61 62
63 -def main():
64 if len(sys.argv) != 1: 65 usage() 66 67 session = DBConn().session() 68 write_sections(session)
69 70 ######################################################################################### 71 72 73 if __name__ == '__main__': 74 main() 75 76 # vim:set et: 77 # vim:set ts=4: 78 # vim:set shiftwidth=4: 79