You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/12/29 15:39:17 UTC

svn commit: r1053645 - /subversion/trunk/tools/po/l10n-report.py

Author: hwright
Date: Wed Dec 29 14:39:17 2010
New Revision: 1053645

URL: http://svn.apache.org/viewvc?rev=1053645&view=rev
Log:
Reduce the external dependencies when sending mail from a helper script.

* tools/po/l10n-report.py
  (main): Use the smtp library for sending mail, rather than shelling out
    to 'sendmail'.

Modified:
    subversion/trunk/tools/po/l10n-report.py

Modified: subversion/trunk/tools/po/l10n-report.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/po/l10n-report.py?rev=1053645&r1=1053644&r2=1053645&view=diff
==============================================================================
--- subversion/trunk/tools/po/l10n-report.py (original)
+++ subversion/trunk/tools/po/l10n-report.py Wed Dec 29 14:39:17 2010
@@ -178,6 +178,9 @@ def main():
         print(po_format)
 
     if to_email_id:
+        import smtplib
+
+        server = smtplib.SMTP('localhost')
         email_from = "From: SVN DEV <no...@subversion.apache.org>"
         email_to = "To: %s" % to_email_id
         email_sub = "Subject: [l10n] Translation status report for %s r%s" \
@@ -186,8 +189,7 @@ def main():
         msg = "%s\n%s\n%s\n%s\n%s\n%s\n%s" % (email_from, email_to,\
               email_sub, title, format_head, format_line, body)
 
-        cmd = ['sendmail', '-t']
-        l10n.safe_command(cmd, msg)
+        server.sendmail(email_from, email_to, msg)
         print("The report is sent to '%s' email id." % to_email_id)
     else:
         print("\nYou have not passed '-m' option, so email is not sent.")



Re: svn commit: r1053645 - /subversion/trunk/tools/po/l10n-report.py

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Wed, Dec 29, 2010 at 3:02 PM, Peter Samuelson <pe...@p12n.org> wrote:
>
> [hwright@apache.org]
>> * tools/po/l10n-report.py
>>   (main): Use the smtp library for sending mail, rather than shelling out
>>     to 'sendmail'.
>
> I know this is a specialty script only run by certain people, but on
> the whole, I think the existence of a working 'sendmail -t' is more
> common than the existence of a working SMTP server listening on
> localhost.
>
> There is the question of the path.  sendmail usually lives in /usr/sbin
> these days, but 15 years ago it was in /usr/lib, and neither is in the
> default path.  Anyway, I'd think /usr/sbin/sendmail is still more
> common than 127.0.0.1 port 25.

Possibly.  We could give both a try by attempting to use smtplib and
then falling back to sendmail in the event that doesn't work.

-Hyrum

Re: svn commit: r1053645 - /subversion/trunk/tools/po/l10n-report.py

Posted by Peter Samuelson <pe...@p12n.org>.
[hwright@apache.org]
> * tools/po/l10n-report.py
>   (main): Use the smtp library for sending mail, rather than shelling out
>     to 'sendmail'.

I know this is a specialty script only run by certain people, but on
the whole, I think the existence of a working 'sendmail -t' is more
common than the existence of a working SMTP server listening on
localhost.

There is the question of the path.  sendmail usually lives in /usr/sbin
these days, but 15 years ago it was in /usr/lib, and neither is in the
default path.  Anyway, I'd think /usr/sbin/sendmail is still more
common than 127.0.0.1 port 25.
-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/