script 875 B

1234567891011121314151617181920212223242526272829303132
  1. #! /usr/bin/python
  2. # -*- python -*-
  3. import os
  4. import re
  5. OUT=os.fdopen(3, 'w')
  6. envprint = False
  7. for var in ['EDITOR', 'PAGER', 'VISUAL', 'REPORTBUGEMAIL', 'DEBEMAIL', 'EMAIL',
  8. 'DEBFULLNAME', 'DEBNAME', 'NAME', 'INTERFACE']:
  9. if var in os.environ:
  10. if not envprint:
  11. print >> OUT, '** Environment settings:'
  12. envprint = True
  13. print >> OUT, '%s="%s"' % (var, os.environ[var])
  14. passwdre = re.compile(r'\s*(smtppasswd)\s+(.*)$')
  15. USERFILE = os.path.expanduser('~/.reportbugrc')
  16. if os.path.exists(USERFILE):
  17. if envprint:
  18. print >> OUT
  19. print >> OUT, '** %s:' % USERFILE
  20. for line in file(USERFILE):
  21. line = line.strip()
  22. if line and not line.startswith('#'):
  23. m = passwdre.match(line)
  24. if m:
  25. line = '%s <omitted>' % m.group(1)
  26. print >> OUT, line