Skip to content

Commit 5fd3d0d

Browse files
committed
upip: Implement install -r option (install from requirements file).
1 parent 3cccc69 commit 5fd3d0d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

upip/upip.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,24 @@ def main():
116116
if sys.argv[1] != "install":
117117
fatal("Only 'install' command supported")
118118

119+
to_install = []
120+
119121
i = 2
120-
while sys.argv[i][0] == "-":
122+
while i < len(sys.argv) and sys.argv[i][0] == "-":
121123
opt = sys.argv[i][1]
122124
i += 1
123125
if opt == "p":
124126
install_path = sys.argv[i]
125127
i += 1
128+
elif opt == "r":
129+
list_file = sys.argv[i]
130+
i += 1
131+
with open(list_file) as f:
132+
while True:
133+
l = f.readline()
134+
if not l:
135+
break
136+
to_install.append(l.rstrip())
126137
else:
127138
fatal("Unknown/unsupported option: " + opt)
128139

@@ -138,7 +149,7 @@ def main():
138149

139150
print("Installing to: " + install_path)
140151

141-
to_install = sys.argv[i:]
152+
to_install.extend(sys.argv[i:])
142153
# sets would be perfect here, but don't depend on them
143154
installed = []
144155
while to_install:

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