src/eric7/Documentation/Source/eric7.MicroPython.MipLocalInstaller.html

branch
mpy_network
changeset 9979
dbafba79461d
child 10479
856476537696
equal deleted inserted replaced
9978:f878ae1e6d21 9979:dbafba79461d
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.MicroPython.MipLocalInstaller</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.MicroPython.MipLocalInstaller</h1>
10
11 <p>
12 Module implementing a MicroPython package installer for devices missing the onboard
13 'mip' package.
14 </p>
15 <h3>Global Attributes</h3>
16
17 <table>
18 <tr><td>MicroPythonPackageIndex</td></tr>
19 </table>
20 <h3>Classes</h3>
21
22 <table>
23
24 <tr>
25 <td><a href="#MipLocalInstaller">MipLocalInstaller</a></td>
26 <td>Class implementing a MicroPython package installer ('mip' replacement).</td>
27 </tr>
28 </table>
29 <h3>Functions</h3>
30
31 <table>
32 <tr><td>None</td></tr>
33 </table>
34 <hr />
35 <hr />
36 <a NAME="MipLocalInstaller" ID="MipLocalInstaller"></a>
37 <h2>MipLocalInstaller</h2>
38
39 <p>
40 Class implementing a MicroPython package installer ('mip' replacement).
41 </p>
42 <h3>Derived from</h3>
43 QObject
44 <h3>Class Attributes</h3>
45
46 <table>
47 <tr><td>None</td></tr>
48 </table>
49 <h3>Class Methods</h3>
50
51 <table>
52 <tr><td>None</td></tr>
53 </table>
54 <h3>Methods</h3>
55
56 <table>
57
58 <tr>
59 <td><a href="#MipLocalInstaller.__init__">MipLocalInstaller</a></td>
60 <td>Constructor</td>
61 </tr>
62 <tr>
63 <td><a href="#MipLocalInstaller.__getFile">__getFile</a></td>
64 <td>Private method to download the requested file.</td>
65 </tr>
66 <tr>
67 <td><a href="#MipLocalInstaller.__installFile">__installFile</a></td>
68 <td>Private method to download a file and copy the data to the given target directory.</td>
69 </tr>
70 <tr>
71 <td><a href="#MipLocalInstaller.__installJson">__installJson</a></td>
72 <td>Private method to install a package and its dependencies as defined by the package JSON file.</td>
73 </tr>
74 <tr>
75 <td><a href="#MipLocalInstaller.__rewriteUrl">__rewriteUrl</a></td>
76 <td>Private method to rewrite the given URL in case of a Github URL.</td>
77 </tr>
78 <tr>
79 <td><a href="#MipLocalInstaller.errorString">errorString</a></td>
80 <td>Public method to get the last error as a string.</td>
81 </tr>
82 <tr>
83 <td><a href="#MipLocalInstaller.installPackage">installPackage</a></td>
84 <td>Public method to install a MicroPython package.</td>
85 </tr>
86 </table>
87 <h3>Static Methods</h3>
88
89 <table>
90 <tr><td>None</td></tr>
91 </table>
92
93 <a NAME="MipLocalInstaller.__init__" ID="MipLocalInstaller.__init__"></a>
94 <h4>MipLocalInstaller (Constructor)</h4>
95 <b>MipLocalInstaller</b>(<i>device, parent=None</i>)
96
97 <p>
98 Constructor
99 </p>
100 <dl>
101
102 <dt><i>device</i> (BaseDevice)</dt>
103 <dd>
104 reference to the connected device
105 </dd>
106 <dt><i>parent</i> (QObject (optional))</dt>
107 <dd>
108 reference to the parent object (defaults to None)
109 </dd>
110 </dl>
111 <a NAME="MipLocalInstaller.__getFile" ID="MipLocalInstaller.__getFile"></a>
112 <h4>MipLocalInstaller.__getFile</h4>
113 <b>__getFile</b>(<i>fileUrl</i>)
114
115 <p>
116 Private method to download the requested file.
117 </p>
118 <dl>
119
120 <dt><i>fileUrl</i> (QUrl)</dt>
121 <dd>
122 URL of the requested file
123 </dd>
124 </dl>
125 <dl>
126 <dt>Return:</dt>
127 <dd>
128 package data or an error message and a success flag
129 </dd>
130 </dl>
131 <dl>
132 <dt>Return Type:</dt>
133 <dd>
134 tuple of (bytes or str, bool)
135 </dd>
136 </dl>
137 <a NAME="MipLocalInstaller.__installFile" ID="MipLocalInstaller.__installFile"></a>
138 <h4>MipLocalInstaller.__installFile</h4>
139 <b>__installFile</b>(<i>fileUrl, targetDir, targetFile</i>)
140
141 <p>
142 Private method to download a file and copy the data to the given target
143 directory.
144 </p>
145 <dl>
146
147 <dt><i>fileUrl</i> (str)</dt>
148 <dd>
149 URL of the file to be downloaded and installed
150 </dd>
151 <dt><i>targetDir</i> (str)</dt>
152 <dd>
153 target directory on the device
154 </dd>
155 <dt><i>targetFile</i> (str)</dt>
156 <dd>
157 file name on the device
158 </dd>
159 </dl>
160 <dl>
161 <dt>Return:</dt>
162 <dd>
163 flag indicating success
164 </dd>
165 </dl>
166 <dl>
167 <dt>Return Type:</dt>
168 <dd>
169 bool
170 </dd>
171 </dl>
172 <a NAME="MipLocalInstaller.__installJson" ID="MipLocalInstaller.__installJson"></a>
173 <h4>MipLocalInstaller.__installJson</h4>
174 <b>__installJson</b>(<i>packageJson, version, mpy, target, index</i>)
175
176 <p>
177 Private method to install a package and its dependencies as defined by the
178 package JSON file.
179 </p>
180 <dl>
181
182 <dt><i>packageJson</i> (dict)</dt>
183 <dd>
184 dictionary containing the package data
185 </dd>
186 <dt><i>version</i> (str)</dt>
187 <dd>
188 package version
189 </dd>
190 <dt><i>mpy</i> (bool)</dt>
191 <dd>
192 flag indicating to install as '.mpy' file
193 </dd>
194 <dt><i>target</i> (str)</dt>
195 <dd>
196 target directory on the device
197 </dd>
198 <dt><i>index</i> (str)</dt>
199 <dd>
200 URL of the package index to be used
201 </dd>
202 </dl>
203 <dl>
204 <dt>Return:</dt>
205 <dd>
206 flag indicating success
207 </dd>
208 </dl>
209 <dl>
210 <dt>Return Type:</dt>
211 <dd>
212 bool
213 </dd>
214 </dl>
215 <a NAME="MipLocalInstaller.__rewriteUrl" ID="MipLocalInstaller.__rewriteUrl"></a>
216 <h4>MipLocalInstaller.__rewriteUrl</h4>
217 <b>__rewriteUrl</b>(<i>url, branch=None</i>)
218
219 <p>
220 Private method to rewrite the given URL in case of a Github URL.
221 </p>
222 <dl>
223
224 <dt><i>url</i> (str)</dt>
225 <dd>
226 URL to be checked and potentially changed
227 </dd>
228 <dt><i>branch</i> (str (optional))</dt>
229 <dd>
230 branch name (defaults to None)
231 </dd>
232 </dl>
233 <dl>
234 <dt>Return:</dt>
235 <dd>
236 rewritten URL
237 </dd>
238 </dl>
239 <dl>
240 <dt>Return Type:</dt>
241 <dd>
242 str
243 </dd>
244 </dl>
245 <a NAME="MipLocalInstaller.errorString" ID="MipLocalInstaller.errorString"></a>
246 <h4>MipLocalInstaller.errorString</h4>
247 <b>errorString</b>(<i></i>)
248
249 <p>
250 Public method to get the last error as a string.
251 </p>
252 <dl>
253 <dt>Return:</dt>
254 <dd>
255 latest error
256 </dd>
257 </dl>
258 <dl>
259 <dt>Return Type:</dt>
260 <dd>
261 str
262 </dd>
263 </dl>
264 <a NAME="MipLocalInstaller.installPackage" ID="MipLocalInstaller.installPackage"></a>
265 <h4>MipLocalInstaller.installPackage</h4>
266 <b>installPackage</b>(<i>package, index=None, target=None, version=None, mpy=True</i>)
267
268 <p>
269 Public method to install a MicroPython package.
270 </p>
271 <dl>
272
273 <dt><i>package</i> (str)</dt>
274 <dd>
275 package name
276 </dd>
277 <dt><i>index</i> (str (optional))</dt>
278 <dd>
279 URL of the package index to be used (defaults to None)
280 </dd>
281 <dt><i>target</i> (str (optional))</dt>
282 <dd>
283 target directory on the device (defaults to None)
284 </dd>
285 <dt><i>version</i> (str (optional))</dt>
286 <dd>
287 package version (defaults to None)
288 </dd>
289 <dt><i>mpy</i> (bool (optional))</dt>
290 <dd>
291 flag indicating to install as '.mpy' file (defaults to True)
292 </dd>
293 </dl>
294 <dl>
295 <dt>Return:</dt>
296 <dd>
297 flag indicating success
298 </dd>
299 </dl>
300 <dl>
301 <dt>Return Type:</dt>
302 <dd>
303 bool
304 </dd>
305 </dl>
306 <div align="right"><a href="#top">Up</a></div>
307 <hr />
308 </body></html>

eric ide

mercurial