From 61702e8873c3162b9b1c6f9a0cdb7ef8dd91abef Mon Sep 17 00:00:00 2001 From: Denis Arrivault <denis.arrivault@lif.univ-mrs.fr> Date: Fri, 18 Dec 2015 14:29:12 +0100 Subject: [PATCH] Assert utf8 encoding of version number is compatible with python 2.7 --- VERSION | 2 +- ltfatpy/__init__.py | 2 +- setup.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index 3f03cea..e43c31e 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -ltfatpy:1.0.1 +ltfatpy:1.0.3 ltfat:2.1.0 diff --git a/ltfatpy/__init__.py b/ltfatpy/__init__.py index 961a61e..d858bf1 100644 --- a/ltfatpy/__init__.py +++ b/ltfatpy/__init__.py @@ -117,4 +117,4 @@ __all__ = ["arg_firwin", "assert_groworder", "assert_sigreshape_post", "long2fir", "normalize", "rms", "thresh", "lcm", "postpad"] -__version__ = "1.0.1" +__version__ = "1.0.3" diff --git a/setup.py b/setup.py index 009e881..c9cc980 100755 --- a/setup.py +++ b/setup.py @@ -50,12 +50,12 @@ def get_version(): def set_version(ltfat_dir, VERSION): filename = os.path.join(ltfat_dir, '__init__.py') buf = "" - for line in open(filename, encoding="utf-8"): - if not line.startswith("__version__ ="): - buf += line - f = open(filename, "w", encoding="utf-8") - f.write(buf) - f.write('__version__ = "%s"\n' % VERSION) + for line in open(filename, "rb"): + if not line.decode("utf8").startswith("__version__ ="): + buf += line.decode("utf8") + f = open(filename, "wb") + f.write(buf.encode("utf8")) + f.write(('__version__ = "%s"\n' % VERSION).encode("utf8")) ################# -- GitLab