...
 
Commits (4)
...@@ -31,10 +31,10 @@ def test_importable_without_matplotlib(): ...@@ -31,10 +31,10 @@ def test_importable_without_matplotlib():
suffix = 'py' suffix = 'py'
assert suffix == 'py' assert suffix == 'py'
fname = sep.join((prefix, suffix)) fname = sep.join((prefix, suffix))
with open(fname) as f: with open(fname, 'rb') as f:
code = f.read() code = f.read()
code = code.replace('from . import', 'from kwant import') code = code.replace(b'from . import', b'from kwant import')
code = code.replace('matplotlib', 'totalblimp') code = code.replace(b'matplotlib', b'totalblimp')
with warnings.catch_warnings(record=True) as w: with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always") warnings.simplefilter("always")
...@@ -253,7 +253,7 @@ def syst_rect(lat, salt, W=3, L=50): ...@@ -253,7 +253,7 @@ def syst_rect(lat, salt, W=3, L=50):
ww = W//2 ww = W//2
def onsite(site): def onsite(site):
return 4 + 0.1 * kwant.digest.gauss(site.tag, salt=salt) return 4 + 0.1 * kwant.digest.gauss(repr(site.tag), salt=salt)
syst[(lat(i, j) for i in range(-ll, ll+1) syst[(lat(i, j) for i in range(-ll, ll+1)
for j in range(-ww, ww+1))] = onsite for j in range(-ww, ww+1))] = onsite
......
...@@ -86,7 +86,7 @@ def get_version_from_git(): ...@@ -86,7 +86,7 @@ def get_version_from_git():
def init(version_file='_kwant_version.py'): def init(version_file='_kwant_version.py'):
global version, version_is_from_git global version, version_is_from_git
version_info = {} version_info = {}
with open(os.path.join(package_root, version_file), 'r') as f: with open(os.path.join(package_root, version_file), 'rb') as f:
exec(f.read(), {}, version_info) exec(f.read(), {}, version_info)
version = version_info['version'] version = version_info['version']
version_is_from_git = (version == "__use_git__") version_is_from_git = (version == "__use_git__")
......
...@@ -243,10 +243,10 @@ class build_tut(Command): ...@@ -243,10 +243,10 @@ class build_tut(Command):
os.mkdir(tut_dir) os.mkdir(tut_dir)
for in_fname in glob.glob('doc/source/tutorial/*.py'): for in_fname in glob.glob('doc/source/tutorial/*.py'):
out_fname = os.path.join(tut_dir, os.path.basename(in_fname)) out_fname = os.path.join(tut_dir, os.path.basename(in_fname))
with open(in_fname) as in_file: with open(in_fname, 'rb') as in_file:
with open(out_fname, 'w') as out_file: with open(out_fname, 'wb') as out_file:
for line in in_file: for line in in_file:
if not line.startswith('#HIDDEN'): if not line.startswith(b'#HIDDEN'):
out_file.write(line) out_file.write(line)
...@@ -364,7 +364,7 @@ def write_version(fname): ...@@ -364,7 +364,7 @@ def write_version(fname):
def long_description(): def long_description():
text = [] text = []
try: try:
with open('README.rst') as f: with open('README.rst', encoding='utf8') as f:
for line in f: for line in f:
if line.startswith('See also in this directory:'): if line.startswith('See also in this directory:'):
break break
......