apply 2to3 and additional fixes

Index: ndiff/setup.py
--- ndiff/setup.py.orig
+++ ndiff/setup.py
@@ -94,7 +94,7 @@ class checked_install(distutils.command.install.instal
         self.saved_prefix = sys.prefix
         try:
             distutils.command.install.install.finalize_options(self)
-        except distutils.errors.DistutilsPlatformError, e:
+        except distutils.errors.DistutilsPlatformError as e:
             raise distutils.errors.DistutilsPlatformError(str(e) + """
 Installing your distribution's python-dev package may solve this problem.""")
 
@@ -227,7 +227,7 @@ for dir in dirs:
         uninstaller_file.close()
 
         # Set exec bit for uninstaller
-        mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0555) & 07777
+        mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0o555) & 0o7777
         os.chmod(uninstaller_filename, mode)
 
     def write_installed_files(self):
@@ -241,7 +241,7 @@ for dir in dirs:
         with open(INSTALLED_FILES_NAME, "w") as f:
             for output in self.get_installed_files():
                 assert "\n" not in output
-                print >> f, output
+                print(output, file=f)
 
 
 class my_uninstall(distutils.cmd.Command):
@@ -263,7 +263,7 @@ class my_uninstall(distutils.cmd.Command):
         # Read the list of installed files.
         try:
             f = open(INSTALLED_FILES_NAME, "r")
-        except IOError, e:
+        except IOError as e:
             if e.errno == errno.ENOENT:
                 log.error("Couldn't open the installation record '%s'. "
                         "Have you installed yet?" % INSTALLED_FILES_NAME)
@@ -286,7 +286,7 @@ class my_uninstall(distutils.cmd.Command):
             try:
                 if not self.dry_run:
                     os.remove(file)
-            except OSError, e:
+            except OSError as e:
                 log.error(str(e))
         # Delete the directories. First reverse-sort the normalized paths by
         # length so that child directories are deleted before their parents.
@@ -297,16 +297,16 @@ class my_uninstall(distutils.cmd.Command):
                 log.info("Removing the directory '%s'." % dir)
                 if not self.dry_run:
                     os.rmdir(dir)
-            except OSError, e:
+            except OSError as e:
                 if e.errno == errno.ENOTEMPTY:
                     log.info("Directory '%s' not empty; not removing." % dir)
                 else:
                     log.error(str(e))
 
 
-distutils.core.setup(name=u"ndiff", scripts=[u"scripts/ndiff"],
-    py_modules=[u"ndiff"],
-    data_files=[(u"share/man/man1", [u"docs/ndiff.1"])],
+distutils.core.setup(name="ndiff", scripts=["scripts/ndiff"],
+    py_modules=["ndiff"],
+    data_files=[("man/man1", ["docs/ndiff.1"])],
     cmdclass={
         "install_egg_info": null_command,
         "install": checked_install,
