Skip to content

Commit

Permalink
send itp mail via npm2deb
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshpatra committed Oct 22, 2019
1 parent 2b7ab51 commit b4b2312
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions npm2deb/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -320,5 +325,17 @@ def _show_mapper_warnings():
print("")


def send_itp(args):
try:
send_to = '[email protected]'
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()

0 comments on commit b4b2312

Please sign in to comment.