kopia lustrzana https://github.com/micropython/micropython-lib
upip: Use gzip dictionary size depending on heap size available.
For systems with 64K of heap or less, use small dictionary size of 4KB. Otherwise, use standard 32KB.pull/107/merge
rodzic
d804100c20
commit
8fa7dcc9c0
|
@ -9,6 +9,7 @@ import upip_utarfile as tarfile
|
|||
debug = False
|
||||
install_path = None
|
||||
cleanup_files = []
|
||||
gzdict_sz = 16 + 15
|
||||
|
||||
file_buf = bytearray(512)
|
||||
|
||||
|
@ -152,13 +153,19 @@ def install_pkg(pkg_spec, install_path):
|
|||
print("Installing %s %s from %s" % (pkg_spec, latest_ver, package_url))
|
||||
package_fname = op_basename(package_url)
|
||||
f1 = url_open(package_url)
|
||||
f2 = uzlib.DecompIO(f1, 16 + 15)
|
||||
f2 = uzlib.DecompIO(f1, gzdict_sz)
|
||||
f3 = tarfile.TarFile(fileobj=f2)
|
||||
meta = install_tar(f3, install_path)
|
||||
f1.close()
|
||||
return meta
|
||||
|
||||
def install(to_install, install_path=None):
|
||||
# Calculate gzip dictionary size to use
|
||||
global gzdict_sz
|
||||
sz = gc.mem_free() + gc.mem_alloc()
|
||||
if sz <= 655360:
|
||||
gzdict_sz = 16 + 12
|
||||
|
||||
if install_path is None:
|
||||
install_path = get_install_path()
|
||||
if install_path[-1] != "/":
|
||||
|
|
Ładowanie…
Reference in New Issue