diff --git a/.moban.d/travis.yml b/.moban.d/travis.yml index 741fd994..01e298ba 100644 --- a/.moban.d/travis.yml +++ b/.moban.d/travis.yml @@ -10,7 +10,6 @@ matrix: {%block custom_python_versions%} python: - &pypy2 pypy2.7-6.0 - - 3.8-dev - 3.7 - 3.6 - 3.5 diff --git a/.travis.yml b/.travis.yml index 6706df51..e5734eba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ notifications: email: false python: - &pypy2 pypy2.7-6.0 - - 3.8-dev - 3.7 - 3.6 - 3.5 diff --git a/moban/hashstore.py b/moban/hashstore.py index 17c9efd9..25b72518 100644 --- a/moban/hashstore.py +++ b/moban/hashstore.py @@ -65,6 +65,8 @@ def get_file_hash(afile): def get_hash(content): md5 = hashlib.md5() + if PY2 and content.__class__.__name__ == "unicode": + content = content.encode("utf-8") md5.update(content) return md5.digest().decode("latin1") diff --git a/moban/utils.py b/moban/utils.py index 3c498c95..87e0f63b 100644 --- a/moban/utils.py +++ b/moban/utils.py @@ -7,6 +7,7 @@ from moban import constants, exceptions log = logging.getLogger(__name__) +PY2 = sys.version_info[0] == 2 def merge(left, right): @@ -60,6 +61,8 @@ def file_permissions(afile): def write_file_out(filename, content): + if PY2 and content.__class__.__name__ == "unicode": + content = content.encode("utf-8") dest_folder = os.path.dirname(filename) if dest_folder: mkdir_p(dest_folder)