home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-debian / examples / changelog / changelog_to_file next >
Encoding:
Text File  |  2008-08-09  |  1.5 KB  |  49 lines

  1. #!/usr/bin/python
  2. # changelog_to_file -- An example of outputting to changelog to a file.
  3. # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18.  
  19. from debian_bundle.changelog import Changelog, Version
  20. import sys
  21.  
  22. changelog = Changelog()
  23.  
  24. changelog.new_block(package='python-debian',
  25.                     version=Version('0.1'),
  26.                     distributions='unstable',
  27.                     urgency='low',
  28.                     author='James Westby <jw+debian@jameswestby.net>',
  29.                     date='Thu,  3 Aug 2006 19:16:22 +0100',
  30.                     )
  31.  
  32. changelog.add_change('');
  33. changelog.add_change('  * Welcome to changelog.py');
  34. changelog.add_change('');
  35.  
  36. try:
  37.   filename = sys.argv[1]
  38. except IndexError:
  39.   print "Usage: "+sys.argv[0]+" filename"
  40.   sys.exit(1)
  41.  
  42. f = open(filename, 'w')
  43.  
  44. try:
  45.   changelog.write_to_open_file(f)
  46. finally:
  47.   f.close()
  48.  
  49.