8000 upip: Prepare to support standalone dependency modules for upip. · micropython/micropython-lib@3f79fc6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f79fc6

Browse files
author
Paul Sokolovsky
committed
upip: Prepare to support standalone dependency modules for upip.
1 parent 5fd3d0d commit 3f79fc6

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

upip/upip.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
import sys
2-
import os
3-
import os.path
4-
import errno
5-
import gzip
1+
def upip_import(mod):
2+
try:
3+
return __import__("upip_" + mod)
4+
except ImportError:
5+
return __import__(mod)
6+
7+
sys = upip_import("sys")
8+
os = upip_import("os")
9+
os.path = upip_import("os.path").path
10+
errno = upip_import("errno")
11+
gzip = upip_import("gzip")
612
try:
7-
import utarfile as tarfile
13+
tarfile = upip_import("utarfile")
814
except ImportError:
9-
import tarfile
15+
tarfile = upip_import("tarfile")
1016
try:
11-
import ujson as json
17+
json = upip_import("ujson")
1218
except ImportError:
13-
import json
19+
json = upip_import("json")
1420

1521

1622
DEFAULT_MICROPYPATH = "~/.micropython/lib:/usr/lib/micropython"

0 commit comments

Comments
 (0)
0