Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6727d0e

Browse files
committed
Always read metadata files as UTF-8 in setup.py
This passes `encoding="utf-8"` to the `open` calls in setup.py, sothe readme, version, and requirements files are always read asUTF-8, even on systems whose locale is not UTF-8. This fixes thebug described in#1747 where installation other than from apre-built wheel would fail on many Windows systems usingnon-European languages.The specific problem occurred with the README.md file. Therequirements files are less likely to contain characters not in theASCII subset, though maybe they could come to contain them, perhapsin comments. The VERSION file is even less likely to ever containsuch characters. Nonetheless, for consistency, because it is a bestpractice, and because it appears to be the intent of the existingcode, encoding="utf=8" is added for opening all of them.This change is tested on a system whose locale uses Windows codepage 936. Editable installation, as well as the other affected waysof installing (and building) described in#1747, are now working.
1 parent5c6a4f4 commit6727d0e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
importos
88
importsys
99

10-
withopen(os.path.join(os.path.dirname(__file__),"VERSION"))asver_file:
10+
withopen(os.path.join(os.path.dirname(__file__),"VERSION"),encoding="utf-8")asver_file:
1111
VERSION=ver_file.readline().strip()
1212

13-
withopen("requirements.txt")asreqs_file:
13+
withopen("requirements.txt",encoding="utf-8")asreqs_file:
1414
requirements=reqs_file.read().splitlines()
1515

16-
withopen("test-requirements.txt")asreqs_file:
16+
withopen("test-requirements.txt",encoding="utf-8")asreqs_file:
1717
test_requirements=reqs_file.read().splitlines()
1818

19-
withopen("README.md")asrm_file:
19+
withopen("README.md",encoding="utf-8")asrm_file:
2020
long_description=rm_file.read()
2121

2222

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp