File tree 1 file changed +19
-3
lines changed
1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -116,22 +116,35 @@ def install_pkg(pkg_spec, install_path):
116
116
f = tarfile .TarFile ("pkg.tar" )
117
117
return install_tar (f , install_path )
118
118
119
+ def help ():
120
+ print ("upip - Simple PyPI package manager for MicroPython" )
121
+ print ("Usage: micropython -m upip install <package>... | -r <requirements.txt>" )
122
+ print ("""\
123
+ Note: only micropython-* packages are supported for installation, upip does not
124
+ support arbitrary code in setup.py.""" )
125
+ sys .exit (1 )
126
+
119
127
def main ():
120
128
install_path = None
121
129
130
+ if len (sys .argv ) < 2 or sys .argv [1 ] == "-h" or sys .argv [1 ] == "--help" :
131
+ help ()
132
+
122
133
if sys .argv [1 ] != "install" :
123
134
fatal ("Only 'install' command supported" )
124
135
125
136
to_install = []
126
137
127
138
i = 2
128
139
while i < len (sys .argv ) and sys .argv [i ][0 ] == "-" :
129
- opt = sys .argv [i ][ 1 ]
140
+ opt = sys .argv [i ]
130
141
i += 1
131
- if opt == "p" :
142
+ if opt == "-h" or opt == "--help" :
143
+ help ()
144
+ elif opt == "-p" :
132
145
install_path = sys .argv [i ]
133
146
i += 1
134
- elif opt == "r" :
147
+ elif opt == "- r" :
135
148
list_file = sys .argv [i ]
136
149
i += 1
137
150
with open (list_file ) as f :
@@ -156,6 +169,9 @@ def main():
156
169
print ("Installing to: " + install_path )
157
170
158
171
to_install .extend (sys .argv [i :])
172
+ if not to_install :
173
+ help ()
174
+
159
175
# sets would be perfect here, but don't depend on them
160
176
installed = []
161
177
while to_install :
You can’t perform that action at this time.
0 commit comments