kopia lustrzana https://github.com/micropython/micropython-lib
upip: Capture recursive dependencies required for standalone running.
Also, improve package import handling.pull/21/merge
rodzic
6456fca976
commit
e8e7e84a89
|
@ -2,6 +2,6 @@ srctype = micropython-lib
|
||||||
type = module
|
type = module
|
||||||
version = 0.1
|
version = 0.1
|
||||||
author = Paul Sokolovsky
|
author = Paul Sokolovsky
|
||||||
extra_modules = upip_errno, upip_gzip, upip_os, upip_os_path, upip_utarfile
|
extra_modules = upip__libc, upip_errno, upip_gzip, upip_os, upip_os_path, upip_stat, upip_utarfile
|
||||||
desc = Simple package manager for MicroPython.
|
desc = Simple package manager for MicroPython.
|
||||||
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.
|
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.
|
||||||
|
|
|
@ -15,4 +15,4 @@ setup(name='micropython-upip',
|
||||||
maintainer='MicroPython Developers',
|
maintainer='MicroPython Developers',
|
||||||
maintainer_email='micro-python@googlegroups.com',
|
maintainer_email='micro-python@googlegroups.com',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
py_modules=['upip', 'upip_errno', 'upip_gzip', 'upip_os', 'upip_os_path', 'upip_utarfile'])
|
py_modules=['upip', 'upip__libc', 'upip_errno', 'upip_gzip', 'upip_os', 'upip_os_path', 'upip_stat', 'upip_utarfile'])
|
||||||
|
|
18
upip/upip.py
18
upip/upip.py
|
@ -1,12 +1,20 @@
|
||||||
def upip_import(mod):
|
def upip_import(mod, sub=None):
|
||||||
try:
|
try:
|
||||||
return __import__("upip_" + mod)
|
mod_ = mod
|
||||||
|
if sub:
|
||||||
|
mod_ += "_" + sub
|
||||||
|
return __import__("upip_" + mod_)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
return __import__(mod)
|
m = __import__(mod)
|
||||||
|
if sub:
|
||||||
|
return getattr(m, sub)
|
||||||
|
return m
|
||||||
|
|
||||||
sys = upip_import("sys")
|
sys = upip_import("sys")
|
||||||
os = upip_import("os")
|
os = upip_import("os")
|
||||||
os.path = upip_import("os.path").path
|
#os.path = upip_import("os.path").path
|
||||||
|
ospath = upip_import("os", "path")
|
||||||
|
|
||||||
errno = upip_import("errno")
|
errno = upip_import("errno")
|
||||||
gzip = upip_import("gzip")
|
gzip = upip_import("gzip")
|
||||||
try:
|
try:
|
||||||
|
@ -103,7 +111,7 @@ def install_pkg(pkg_spec, install_path):
|
||||||
packages = data["releases"][latest_ver]
|
packages = data["releases"][latest_ver]
|
||||||
assert len(packages) == 1
|
assert len(packages) == 1
|
||||||
package_url = packages[0]["url"]
|
package_url = packages[0]["url"]
|
||||||
package_fname = os.path.basename(package_url)
|
package_fname = ospath.basename(package_url)
|
||||||
print(package_url)
|
print(package_url)
|
||||||
download(package_url, package_fname)
|
download(package_url, package_fname)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue