kopia lustrzana https://github.com/micropython/micropython-lib
upip: Implement install -r option (install from requirements file).
rodzic
3cccc69aac
commit
5fd3d0d860
15
upip/upip.py
15
upip/upip.py
|
@ -116,13 +116,24 @@ def main():
|
||||||
if sys.argv[1] != "install":
|
if sys.argv[1] != "install":
|
||||||
fatal("Only 'install' command supported")
|
fatal("Only 'install' command supported")
|
||||||
|
|
||||||
|
to_install = []
|
||||||
|
|
||||||
i = 2
|
i = 2
|
||||||
while sys.argv[i][0] == "-":
|
while i < len(sys.argv) and sys.argv[i][0] == "-":
|
||||||
opt = sys.argv[i][1]
|
opt = sys.argv[i][1]
|
||||||
i += 1
|
i += 1
|
||||||
if opt == "p":
|
if opt == "p":
|
||||||
install_path = sys.argv[i]
|
install_path = sys.argv[i]
|
||||||
i += 1
|
i += 1
|
||||||
|
elif opt == "r":
|
||||||
|
list_file = sys.argv[i]
|
||||||
|
i += 1
|
||||||
|
with open(list_file) as f:
|
||||||
|
while True:
|
||||||
|
l = f.readline()
|
||||||
|
if not l:
|
||||||
|
break
|
||||||
|
to_install.append(l.rstrip())
|
||||||
else:
|
else:
|
||||||
fatal("Unknown/unsupported option: " + opt)
|
fatal("Unknown/unsupported option: " + opt)
|
||||||
|
|
||||||
|
@ -138,7 +149,7 @@ def main():
|
||||||
|
|
||||||
print("Installing to: " + install_path)
|
print("Installing to: " + install_path)
|
||||||
|
|
||||||
to_install = sys.argv[i:]
|
to_install.extend(sys.argv[i:])
|
||||||
# sets would be perfect here, but don't depend on them
|
# sets would be perfect here, but don't depend on them
|
||||||
installed = []
|
installed = []
|
||||||
while to_install:
|
while to_install:
|
||||||
|
|
Ładowanie…
Reference in New Issue