diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cb907c..7d45ead 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## CHANGELOG +### 2.0.1 + +* Better license file open handling in Python 3 + ### 2.0.0 * Dropped support Python 2.7 diff --git a/piplicenses.py b/piplicenses.py index b5a0a16..e9ad269 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -60,7 +60,7 @@ open = open # allow monkey patching __pkgname__ = 'pip-licenses' -__version__ = '2.0.0' +__version__ = '2.0.1' __author__ = 'raimon' __license__ = 'MIT License' __summary__ = ('Dump the software license list of ' @@ -139,7 +139,7 @@ def get_pkg_license_file(pkg): for test_file in glob.glob(license_file_base): if os.path.exists(test_file): license_file = test_file - with open(test_file) as license_file_handle: + with open(test_file, encoding='utf-8') as license_file_handle: license_text = license_file_handle.read() break return (license_file, license_text) @@ -598,7 +598,7 @@ def save_if_needs(output_file, output_string): return try: - with open(output_file, 'w') as f: + with open(output_file, 'w', encoding='utf-8') as f: f.write(output_string) sys.stdout.write('created path: ' + output_file + '\n') sys.exit(0) diff --git a/setup.cfg b/setup.cfg index 2aba3fc..5526edb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bdist_wheel] -universal=1 +universal=0 [aliases] test=pytest [tool:pytest]