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 16, 2019
1 parent 2b7ab51 commit f2969c9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 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 toend 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,18 @@ 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)
print(open_mail)
_os.system(open_mail)
except:
print('ITP file not found!')


if __name__ == '__main__':
main()

0 comments on commit f2969c9

Please sign in to comment.