forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support binary read when encoding=None (python#29)
Closes python#28
- Loading branch information
Showing
6 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Remake the ziptestdata.zip file. | ||
Run this to rebuild the importlib_resources/tests/data/ziptestdata.zip file, | ||
e.g. if you want to add a new file to the zip. | ||
This will replace the file with the new build, but it won't commit anything to | ||
git. | ||
""" | ||
|
||
import os | ||
from zipfile import ZipFile | ||
|
||
RELPATH = 'importlib_resources/tests/data' | ||
CONTENTS = [ | ||
# filenames - the source will always be prepended by | ||
# importlib_resources/tests/data/ziptestdata.zip and the destination will | ||
# always be prepended by ziptestdata/ | ||
'__init__.py', | ||
'binary.file', | ||
'utf-16.file', | ||
'utf-8.file', | ||
] | ||
|
||
|
||
zip_file_path = os.path.join(RELPATH, 'ziptestdata.zip') | ||
|
||
with ZipFile(zip_file_path, 'w') as zf: | ||
for filename in CONTENTS: | ||
src = os.path.join(RELPATH, filename) | ||
dst = os.path.join('ziptestdata', filename) | ||
zf.write(src, dst) |