1 # Copyright (C) 2006, Thomas Leonard
2 # See http://0install.net/0compile.html
4 import os
, __main__
, codecs
5 from os
.path
import join
7 from support
import BuildEnv
9 def do_report_bug(args
):
13 log_name
= 'build/build-failure.log'
14 build_log
= codecs
.open(log_name
, 'r', 'utf-8')
15 log_text
= build_log
.read()
18 build_env_xml_file
= join(buildenv
.metadir
, 'build-environment.xml')
19 if os
.path
.exists(build_env_xml_file
):
20 build_env_xml
= file(build_env_xml_file
)
21 log_text
+= '\n\nSelected versions:\n' + build_env_xml
.read()
24 log_text
+= '\n\n"%s" file not found' % build_env_xml_file
26 log_text
= codecs
.encode(log_text
, 'utf-8')
29 from urllib2
import urlopen
31 print "Sending contents of %s file to default bug tracker..." % log_name
33 stream
= urlopen('http://sourceforge.net/tracker/index.php',
39 'summary': log_text
.split('\n', 1)[0], # First line of log
40 'details': log_text
}))
44 __main__
.commands
.append(do_report_bug
)