diff --git a/npm2deb/scripts.py b/npm2deb/scripts.py index 42a5d66..01320cf 100644 --- a/npm2deb/scripts.py +++ b/npm2deb/scripts.py @@ -147,6 +147,11 @@ def main(argv=None): 'name', nargs='?', help='the license name to show') parser_license.set_defaults(func=print_license) + parser_senditpmail = subparsers.add_parser('senditpmail', help="send itp mail from template") + parser_senditpmail.add_argument( + 'file', help='pass file location to send mail from') + parser_senditpmail.set_defaults(func=send_itp) + if len(argv) == 1: parser.error("Please specify an option.") else: @@ -320,5 +325,17 @@ def _show_mapper_warnings(): print("") +def send_itp(args): + try: + send_to = 'submit@bugs.debian.org' + sub = '\"ITP: ' + (args.file.replace('_itp.mail', ''))[args.file.rfind('node-'):] + ' -- FIX_ME write the Debian package description\"' + file = open(args.file, 'r').read() + mail_body = '\"'+'\n'.join(file.split('\n')[3:])+'\"' + open_mail = 'echo '+str(mail_body)+' | mail -s '+str(sub)+' '+str(send_to) + _os.system(open_mail) + except: + print('ITP file not found!') + + if __name__ == '__main__': main()