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 5fd3d0d commit 3f79fc6Copy full SHA for 3f79fc6
upip/upip.py
@@ -1,16 +1,22 @@
1
-import sys
2
-import os
3
-import os.path
4
-import errno
5
-import gzip
+def upip_import(mod):
+ try:
+ return __import__("upip_" + mod)
+ except ImportError:
+ 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")
12
try:
- import utarfile as tarfile
13
+ tarfile = upip_import("utarfile")
14
except ImportError:
- import tarfile
15
+ tarfile = upip_import("tarfile")
16
- import ujson as json
17
+ json = upip_import("ujson")
18
- import json
19
+ json = upip_import("json")
20
21
22
DEFAULT_MICROPYPATH = "~/.micropython/lib:/usr/lib/micropython"
0 commit comments