We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7bc041e commit 542c8cfCopy full SHA for 542c8cf
upip/upip.py
@@ -11,6 +11,8 @@
11
debug = False
12
cleanup_files = []
13
14
+file_buf = bytearray(512)
15
+
16
class NotFoundError(Exception):
17
pass
18
@@ -44,13 +46,13 @@ def _makedirs(name, mode=0o777):
44
46
45
47
48
def save_file(fname, subf):
- outf = open(fname, "wb")
- while True:
49
- buf = subf.read(1024)
50
- if not buf:
51
- break
52
- outf.write(buf)
53
- outf.close()
+ global file_buf
+ with open(fname, "wb") as outf:
+ while True:
+ sz = subf.readinto(file_buf)
+ if not sz:
54
+ break
55
+ outf.write(file_buf, sz)
56
57
def install_tar(f, prefix):
58
meta = {}
0 commit comments