Commits

Naresh Khalasi committed 72cdd93

Converted to Python3 using 2to3 tool.

  • Participants
  • Parent commits 3b5faaa
  • Branches py2to3

Comments (0)

Files changed (5)

         from md5 import md5
         digest = md5(data).hexdigest()
         if digest != md5_data[egg_name]:
-            print >>sys.stderr, (
+            print((
                 "md5 validation of %s failed!  (Possible download problem?)"
                 % egg_name
-            )
+            ), file=sys.stderr)
             sys.exit(2)
     return data
 
         return do_download()       
     try:
         pkg_resources.require("setuptools>="+version); return
-    except pkg_resources.VersionConflict, e:
+    except pkg_resources.VersionConflict as e:
         if was_imported:
-            print >>sys.stderr, (
+            print((
             "The required version of setuptools (>=%s) is not available, and\n"
             "can't be installed while this script is running. Please install\n"
             " a more recent version first, using 'easy_install -U setuptools'."
             "\n\n(Currently using %r)"
-            ) % (version, e.args[0])
+            ) % (version, e.args[0]), file=sys.stderr)
             sys.exit(2)
         else:
             del pkg_resources, sys.modules['pkg_resources']    # reload ok
     with a '/'). `to_dir` is the directory where the egg will be downloaded.
     `delay` is the number of seconds to pause before an actual download attempt.
     """
-    import urllib2, shutil
+    import urllib.request, urllib.error, urllib.parse, shutil
     egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
     url = download_base + egg_name
     saveto = os.path.join(to_dir, egg_name)
                     version, download_base, delay, url
                 ); from time import sleep; sleep(delay)
             log.warn("Downloading %s", url)
-            src = urllib2.urlopen(url)
+            src = urllib.request.urlopen(url)
             # Read/write all in one block, so we don't create a corrupt file
             # if the download is interrupted.
             data = _validate_md5(egg_name, src.read())
                 os.unlink(egg)
     else:
         if setuptools.__version__ == '0.0.1':
-            print >>sys.stderr, (
+            print((
             "You have an obsolete version of setuptools installed.  Please\n"
             "remove it from your system entirely before rerunning this script."
-            )
+            ), file=sys.stderr)
             sys.exit(2)
 
     req = "setuptools>="+version
             from setuptools.command.easy_install import main
             main(argv)
         else:
-            print "Setuptools version",version,"or greater has been installed."
-            print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
+            print("Setuptools version",version,"or greater has been installed.")
+            print('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)')
 
 def update_md5(filenames):
     """Update our built-in md5 registry"""
         md5_data[base] = md5(f.read()).hexdigest()
         f.close()
 
-    data = ["    %r: %r,\n" % it for it in md5_data.items()]
+    data = ["    %r: %r,\n" % it for it in list(md5_data.items())]
     data.sort()
     repl = "".join(data)
 
 
     match = re.search("\nmd5_data = {\n([^}]+)}", src)
     if not match:
-        print >>sys.stderr, "Internal error!"
+        print("Internal error!", file=sys.stderr)
         sys.exit(2)
 
     src = src[:match.start(1)] + repl + src[match.end(1):]

File src/lazr.smtptest.egg-info/PKG-INFO

-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: lazr.smtptest
 Version: 1.3
 Summary: A package providing a test framework for SMTP based applications.
 License: LGPL v3
 Download-URL: https://launchpad.net/lazr.smtptest/+download
 Description: ..
-        This file is part of lazr.smtptest.
+            This file is part of lazr.smtptest.
         
-        lazr.smtptest is free software: you can redistribute it and/or modify it
-        under the terms of the GNU Lesser General Public License as published by
-        the Free Software Foundation, version 3 of the License.
+            lazr.smtptest is free software: you can redistribute it and/or modify it
+            under the terms of the GNU Lesser General Public License as published by
+            the Free Software Foundation, version 3 of the License.
         
-        lazr.smtptest is distributed in the hope that it will be useful, but
-        WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-        or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-        License for more details.
+            lazr.smtptest is distributed in the hope that it will be useful, but
+            WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+            or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+            License for more details.
         
-        You should have received a copy of the GNU Lesser General Public License
-        along with lazr.smtptest.  If not, see <http://www.gnu.org/licenses/>.
+            You should have received a copy of the GNU Lesser General Public License
+            along with lazr.smtptest.  If not, see <http://www.gnu.org/licenses/>.
         
         LAZR smtptest
         *************
         ensure proper operation of your applications which send email.
         
         .. toctree::
-        :glob:
+           :glob:
         
-        *
-        docs/*
+           *
+           docs/*
         
         .. _Sphinx: http://sphinx.pocoo.org/
         .. _Table of contents: http://sphinx.pocoo.org/concepts.html#the-toc-tree
         
         The lazr.smtptest package is importable, and has a version number.
         
-        >>> import lazr.smtptest
-        >>> print 'VERSION:', lazr.smtptest.__version__
-        VERSION: ...
+            >>> import lazr.smtptest
+            >>> print 'VERSION:', lazr.smtptest.__version__
+            VERSION: ...
         
         More information
         ================
         ================
         
         - Make the test server thread-safe with other code that starts an asyncore
-        loop.  Requires Python 2.6 or 2.7.
+          loop.  Requires Python 2.6 or 2.7.
         
         - Be cleaner about stopping the server: before, it left sockets running
-        ans simply cleared out the socket map.  In an associated change, the EXIT
-        smtp command sends the reply first, and then shuts down the server, rather
-        than the other way around.
+          ans simply cleared out the socket map.  In an associated change, the EXIT
+          smtp command sends the reply first, and then shuts down the server, rather
+          than the other way around.
         
         1.2 (2009-07-07)
         ================
         
         - [bug 393621] QueueServer.reset() was added to clear the message queue.  This
-        is invoked by sending an SMTP RSET command to the server, or through
-        Controller.reset().
+          is invoked by sending an SMTP RSET command to the server, or through
+          Controller.reset().
         
         
         1.1 (2009-06-29)
         ================
         
         - [bug 391650] A non-public API was added to make QueueController more easily
-        subclassable.
+          subclassable.
         
         
         1.0 (2009-06-22)

File src/lazr.smtptest.egg-info/SOURCES.txt

 README.txt
 ez_setup.py
 pylint.rc
+setup.cfg
 setup.py
 src/lazr/__init__.py
 src/lazr.smtptest.egg-info/PKG-INFO

File src/lazr/smtptest/controller.py

 import smtplib
 import threading
 
-from Queue import Empty, Queue
+from queue import Empty, Queue
 
 from lazr.smtptest.server import QueueServer
 

File src/lazr/smtptest/server.py

 import logging
 import asyncore
 
-from Queue import Empty
+from queue import Empty
 from email import message_from_string