Skip to content

Commit cbc423a

Browse files
committed
upip: Remove unneed cruft.
upip now works only with MicroPython, and the only Py-level dependency is upip_utarfile.
1 parent 62671a4 commit cbc423a

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed

upip/upip.py

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
1-
def upip_import(mod, sub=None):
2-
try:
3-
mod_ = mod
4-
if sub:
5-
mod_ += "_" + sub
6-
return __import__("upip_" + mod_)
7-
except ImportError:
8-
m = __import__(mod)
9-
if sub:
10-
return getattr(m, sub)
11-
return m
12-
13-
sys = upip_import("sys")
1+
import sys
142
import uos as os
153
import uerrno as errno
4+
import ujson as json
165
import uzlib
17-
18-
try:
19-
tarfile = upip_import("utarfile")
20-
except ImportError:
21-
tarfile = upip_import("tarfile")
22-
try:
23-
json = upip_import("ujson")
24-
except ImportError:
25-
json = upip_import("json")
6+
import upip_utarfile as tarfile
267

278

289
DEFAULT_MICROPYPATH = "~/.micropython/lib:/usr/lib/micropython"
@@ -168,17 +149,6 @@ def fatal(msg):
168149
print(msg)
169150
sys.exit(1)
170151

171-
def gzdecompress(package_fname):
172-
f = open(package_fname, "rb")
173-
zipdata = f.read()
174-
data = gzip.decompress(zipdata)
175-
return data
176-
177-
def gzdecompress_(package_fname):
178-
os.system("gzip -d -c %s > ungz" % package_fname)
179-
with open("ungz", "rb") as f:
180-
return f.read()
181-
182152
def install_pkg(pkg_spec, install_path):
183153
data = get_pkg_metadata(pkg_spec)
184154

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy