Donald Stufft avatar Donald Stufft committed 0a27c20

Fix up the email script

Comments (0)

Files changed (1)

tools/email_renamed_users.py

 Hello there!
 
 PyPI has begun to enforce restrictions on what a valid Python package name
-contains. These rules are:
+contains.
 
-* Must contain ONLY ASCII letters, digits, underscores, hyphens, and
-periods
+These rules are:
+
+* Must contain ONLY ASCII letters, digits, underscores, hyphens, and periods
 * Must begin and end with an ASCII letter or digit
 
-You are listed as an owner or maintainer on %(old)s. Due to
-the new rules these packages will be renamed to %(new)s.
-These new names represent what someone using pip or easy_install would
-already have had to use in order to install your packages.
+You are listed as an owner or maintainer on %(old)s.
+
+Due to the new rules these packages will be renamed to %(new)s.
+
+These new names represent what someone using pip or easy_install would already
+have had to use in order to install your packages.
 
 I am sorry for any inconvenience this may have caused you.
 """
 Hello there!
 
 PyPI has begun to enforce restrictions on what a valid Python package name
-contains. These rules are:
+contains.
 
-* Must contain ONLY ASCII letters, digits, underscores, hyphens, and
-periods
+These rules are:
+
+* Must contain ONLY ASCII letters, digits, underscores, hyphens, and periods
 * Must begin and end with an ASCII letter or digit
 
-You are listed as an owner or maintainer on %(old)s. Due to
-the new rules this package will be renamed to %(new)s.
-These new names represent what someone using pip or easy_install would
+You are listed as an owner or maintainer on "%(old)s".
+
+Due to the new rules this package will be renamed to "%(new)s".
+
+This new name represents what someone using pip or easy_install would
 already have had to use in order to install your package.
 
 I am sorry for any inconvenience this may have caused you.
 # Email each user
 server = smtplib.SMTP(config.mailhost)
 for username, packages in users.iteritems():
+    packages = sorted(set(packages))
 
     user = store.get_user(username)
 
 
     if len(packages) > 1:
         msg = MIMEText(EMAIL_PLURAL % {
-                                "old": ", ".join([x[0] for x in packages]),
-                                "new": ", ".join([x[1] for x in packages]),
-                            })
+                        "old": ", ".join(['"%s"' % x[0] for x in packages]),
+                        "new": ", ".join(['"%s"' % x[1] for x in packages]),
+                    })
     elif packages:
         msg = MIMEText(EMAIL_SINGLE % {
                                 "old": packages[0][0],
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.