From 3d73b19cdabd2e5ae6bb7b9f02c9a2f3111fe70e Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph.weston@cea.fr>
Date: Fri, 7 Aug 2015 14:05:26 +0200
Subject: [PATCH] update setup script and copied function in _common.py

---
 kwant/_common.py | 3 +--
 setup.py         | 8 ++++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/kwant/_common.py b/kwant/_common.py
index 50afc250..b9ea7aec 100644
--- a/kwant/_common.py
+++ b/kwant/_common.py
@@ -22,8 +22,7 @@ def get_version_from_git():
         return
     if p.wait() != 0:
         return
-    # TODO: use os.path.samefile once we depend on Python >= 3.3.
-    if os.path.normpath(p.communicate()[0].rstrip('\n')) != distr_root:
+    if not os.path.samefile(p.communicate()[0].decode().rstrip('\n'), distr_root):
         # The top-level directory of the current Git repository is not the same
         # as the root directory of the Kwant distribution: do not extract the
         # version from Git.
diff --git a/setup.py b/setup.py
index 3b884b97..444fa71d 100755
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ import os
 import glob
 import imp
 import subprocess
-import ConfigParser
+import configparser
 from setuptools import setup, find_packages, Extension, Command
 from sysconfig import get_platform
 from distutils.errors import DistutilsError, DistutilsModuleError, \
@@ -263,7 +263,7 @@ def search_mumps():
     except OSError:
         pass
     else:
-        p.communicate(input='int main() {}\n')
+        p.communicate(input=b'int main() {}\n')
         if p.wait() == 0:
             return {'libraries': libs}
     return {}
@@ -297,7 +297,7 @@ def extensions():
                       'kwant/graph/c_slicer/slicer.h']})]
 
     #### Add components of Kwant with external compile-time dependencies.
-    config = ConfigParser.ConfigParser()
+    config = configparser.ConfigParser()
     try:
         with open(CONFIG_FILE) as f:
             config.readfp(f)
@@ -334,7 +334,7 @@ def extensions():
         if kwrds:
             build_summary.append('Auto-configured MUMPS')
     if kwrds:
-        for name, value in lapack.iteritems():
+        for name, value in lapack.items():
             kwrds.setdefault(name, []).extend(value)
         kwrds.setdefault('depends', []).extend(
             [CONFIG_FILE, 'kwant/linalg/cmumps.pxd'])
-- 
GitLab