From 16e4c1eee205dbf803f8da568cf80ab38a3698a6 Mon Sep 17 00:00:00 2001 From: Nilesh Date: Wed, 16 Oct 2019 01:09:45 +0530 Subject: [PATCH] send itp mail via npm2deb --- npm2deb/scripts.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/npm2deb/scripts.py b/npm2deb/scripts.py index 42a5d66..9df3929 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( + 'node_module', help='node module available via npm') + parser_senditpmail.set_defaults(func=send_itp) + if len(argv) == 1: parser.error("Please specify an option.") else: @@ -320,5 +325,20 @@ def _show_mapper_warnings(): print("") +def send_itp(args): + mail_itp(str(args.node_module), str(get_npm2deb_instance(args).get_ITP())) + + +def mail_itp(node_module=None, template=None): + try: + send_to = 'submit@bugs.debian.org' + sub = '\"ITP: ' + str(node_module) + ' -- FIX_ME write the Debian package description\"' + mail_body = '\"'+'\n'.join(template.split('\n')[3:])+'\"' + open_mail = 'xdg-email --body '+str(mail_body)+' --subject '+str(sub)+' '+str(send_to) + _os.system(open_mail) + except: + print('ITP file not found!') + + if __name__ == '__main__': main()