Skip to content

Commit e8e7e84

Browse files
committed
upip: Capture recursive dependencies required for standalone running.
Also, improve package import handling.
1 parent 6456fca commit e8e7e84

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

upip/metadata.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ srctype = micropython-lib
22
type = module
33
version = 0.1
44
author = Paul Sokolovsky
5-
extra_modules = upip_errno, upip_gzip, upip_os, upip_os_path, upip_utarfile
5+
extra_modules = upip__libc, upip_errno, upip_gzip, upip_os, upip_os_path, upip_stat, upip_utarfile
66
desc = Simple package manager for MicroPython.
77
long_desc = Simple package manager for MicroPython, targetting to be self-hosted (but not yet there). Compatible only with packages without custom setup.py code.

upip/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
maintainer='MicroPython Developers',
1616
maintainer_email='micro-python@googlegroups.com',
1717
license='MIT',
18-
py_modules=['upip', 'upip_errno', 'upip_gzip', 'upip_os', 'upip_os_path', 'upip_utarfile'])
18+
py_modules=['upip', 'upip__libc', 'upip_errno', 'upip_gzip', 'upip_os', 'upip_os_path', 'upip_stat', 'upip_utarfile'])

upip/upip.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
def upip_import(mod):
1+
def upip_import(mod, sub=None):
22
try:
3-
return __import__("upip_" + mod)
3+
mod_ = mod
4+
if sub:
5+
mod_ += "_" + sub
6+
return __import__("upip_" + mod_)
47
except ImportError:
5-
return __import__(mod)
8+
m = __import__(mod)
9+
if sub:
10+
return getattr(m, sub)
11+
return m
612

713
sys = upip_import("sys")
814
os = upip_import("os")
9-
os.path = upip_import("os.path").path
15+
#os.path = upip_import("os.path").path
16+
ospath = upip_import("os", "path")
17+
1018
errno = upip_import("errno")
1119
gzip = upip_import("gzip")
1220
try:
@@ -103,7 +111,7 @@ def install_pkg(pkg_spec, install_path):
103111
packages = data["releases"][latest_ver]
104112
assert len(packages) == 1
105113
package_url = packages[0]["url"]
106-
package_fname = os.path.basename(package_url)
114+
package_fname = ospath.basename(package_url)
107115
print(package_url)
108116
download(package_url, package_fname)
109117

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