From f2969c9c069b63420f1653504d478754aa6bd7c8 Mon Sep 17 00:00:00 2001 From: Nilesh Date: Wed, 16 Oct 2019 12:39:28 +0530 Subject: [PATCH] send itp mail via npm2deb --- npm2deb/scripts.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/npm2deb/scripts.py b/npm2deb/scripts.py index 42a5d66..be6ee41 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 toend mail from') + parser_senditpmail.set_defaults(func=send_itp) + if len(argv) == 1: parser.error("Please specify an option.") else: @@ -320,5 +325,18 @@ 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) + print(open_mail) + _os.system(open_mail) + except: + print('ITP file not found!') + + if __name__ == '__main__': main()