Navigation Menu

Skip to content

Commit

Permalink
Change how setup.py opens files
Browse files Browse the repository at this point in the history
In Python3 environments where LANG=, then Python uses the ascii codec to decode
files. That broke when we added a non-ascii character to CHANGES in the last
release.

Fixes #324.
  • Loading branch information
willkg committed Oct 2, 2017
1 parent 42629f7 commit c64dd26
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions setup.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python

import codecs
import os
import re
import sys
Expand All @@ -25,16 +26,16 @@


def get_long_desc():
desc = open('README.rst').read()
desc = codecs.open('README.rst', encoding='utf-8').read()
desc += '\n\n'
desc += open('CHANGES').read()
desc += codecs.open('CHANGES', encoding='utf-8').read()
return desc


def get_version():
fn = os.path.join('bleach', '__init__.py')
vsre = r"""^__version__ = ['"]([^'"]*)['"]"""
version_file = open(fn, 'rt').read()
version_file = codecs.open(fn, mode='r', encoding='utf-8').read()
return re.search(vsre, version_file, re.M).group(1)


Expand Down

0 comments on commit c64dd26

Please sign in to comment.