micropython-stubber 1.24.1__py3-none-any.whl → 1.24.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/METADATA +9 -29
- micropython_stubber-1.24.4.dist-info/RECORD +107 -0
- {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/WHEEL +1 -1
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +44 -38
- stubber/board/createstubs_db.py +17 -12
- stubber/board/createstubs_db_min.py +63 -63
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +17 -12
- stubber/board/createstubs_mem_min.py +99 -99
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +111 -112
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/board/modulelist.txt +27 -27
- stubber/codemod/board.py +1 -1
- stubber/codemod/enrich.py +13 -13
- stubber/codemod/merge_docstub.py +83 -53
- stubber/codemod/visitors/type_helpers.py +143 -41
- stubber/commands/enrich_folder_cmd.py +17 -17
- stubber/commands/get_docstubs_cmd.py +27 -9
- stubber/commands/get_frozen_cmd.py +1 -0
- stubber/commands/merge_cmd.py +2 -4
- stubber/merge_config.py +5 -36
- stubber/minify.py +3 -3
- stubber/modcat.py +118 -0
- stubber/publish/merge_docstubs.py +22 -5
- stubber/publish/stubpackage.py +33 -28
- stubber/rst/lookup.py +6 -23
- stubber/rst/reader.py +8 -13
- stubber/stubs_from_docs.py +2 -1
- stubber/tools/manifestfile.py +2 -1
- stubber/{cst_transformer.py → typing_collector.py} +36 -4
- micropython_stubber-1.24.1.dist-info/RECORD +0 -161
- mpflash/README.md +0 -220
- mpflash/libusb_flash.ipynb +0 -203
- mpflash/mpflash/__init__.py +0 -0
- mpflash/mpflash/add_firmware.py +0 -98
- mpflash/mpflash/ask_input.py +0 -236
- mpflash/mpflash/basicgit.py +0 -324
- mpflash/mpflash/bootloader/__init__.py +0 -2
- mpflash/mpflash/bootloader/activate.py +0 -60
- mpflash/mpflash/bootloader/detect.py +0 -82
- mpflash/mpflash/bootloader/manual.py +0 -101
- mpflash/mpflash/bootloader/micropython.py +0 -12
- mpflash/mpflash/bootloader/touch1200.py +0 -36
- mpflash/mpflash/cli_download.py +0 -129
- mpflash/mpflash/cli_flash.py +0 -224
- mpflash/mpflash/cli_group.py +0 -111
- mpflash/mpflash/cli_list.py +0 -87
- mpflash/mpflash/cli_main.py +0 -39
- mpflash/mpflash/common.py +0 -217
- mpflash/mpflash/config.py +0 -44
- mpflash/mpflash/connected.py +0 -96
- mpflash/mpflash/download.py +0 -364
- mpflash/mpflash/downloaded.py +0 -138
- mpflash/mpflash/errors.py +0 -9
- mpflash/mpflash/flash/__init__.py +0 -55
- mpflash/mpflash/flash/esp.py +0 -59
- mpflash/mpflash/flash/stm32.py +0 -19
- mpflash/mpflash/flash/stm32_dfu.py +0 -104
- mpflash/mpflash/flash/uf2/__init__.py +0 -88
- mpflash/mpflash/flash/uf2/boardid.py +0 -15
- mpflash/mpflash/flash/uf2/linux.py +0 -136
- mpflash/mpflash/flash/uf2/macos.py +0 -42
- mpflash/mpflash/flash/uf2/uf2disk.py +0 -12
- mpflash/mpflash/flash/uf2/windows.py +0 -43
- mpflash/mpflash/flash/worklist.py +0 -170
- mpflash/mpflash/list.py +0 -106
- mpflash/mpflash/logger.py +0 -41
- mpflash/mpflash/mpboard_id/__init__.py +0 -98
- mpflash/mpflash/mpboard_id/add_boards.py +0 -262
- mpflash/mpflash/mpboard_id/board.py +0 -37
- mpflash/mpflash/mpboard_id/board_id.py +0 -90
- mpflash/mpflash/mpboard_id/board_info.zip +0 -0
- mpflash/mpflash/mpboard_id/store.py +0 -48
- mpflash/mpflash/mpremoteboard/__init__.py +0 -271
- mpflash/mpflash/mpremoteboard/mpy_fw_info.py +0 -152
- mpflash/mpflash/mpremoteboard/runner.py +0 -140
- mpflash/mpflash/vendor/board_database.py +0 -185
- mpflash/mpflash/vendor/click_aliases.py +0 -91
- mpflash/mpflash/vendor/dfu.py +0 -165
- mpflash/mpflash/vendor/pydfu.py +0 -605
- mpflash/mpflash/vendor/readme.md +0 -12
- mpflash/mpflash/versions.py +0 -123
- mpflash/poetry.lock +0 -2603
- mpflash/pyproject.toml +0 -66
- mpflash/stm32_udev_rules.md +0 -63
- stubber/codemod/test_enrich.py +0 -87
- {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/entry_points.txt +0 -0
@@ -34,12 +34,12 @@ L='port'
|
|
34
34
|
K='.'
|
35
35
|
I=AttributeError
|
36
36
|
H=False
|
37
|
-
G=
|
38
|
-
|
39
|
-
D=
|
37
|
+
G=None
|
38
|
+
E='/'
|
39
|
+
D=OSError
|
40
40
|
C='version'
|
41
41
|
B=''
|
42
|
-
import gc as
|
42
|
+
import gc as F,os,sys
|
43
43
|
from time import sleep
|
44
44
|
try:from ujson import dumps
|
45
45
|
except:from json import dumps
|
@@ -49,8 +49,9 @@ try:from collections import OrderedDict as g
|
|
49
49
|
except N:from ucollections import OrderedDict as g
|
50
50
|
__version__='v1.24.0'
|
51
51
|
y=2
|
52
|
-
z=
|
53
|
-
A0=
|
52
|
+
z=44
|
53
|
+
A0=2
|
54
|
+
A1=['lib','/lib','/sd/lib','/flash/lib',K]
|
54
55
|
class J:
|
55
56
|
DEBUG=10;INFO=20;WARNING=30;ERROR=40;level=INFO;prnt=O
|
56
57
|
@staticmethod
|
@@ -68,149 +69,148 @@ class J:
|
|
68
69
|
A=J.getLogger(o)
|
69
70
|
J.basicConfig(level=J.INFO)
|
70
71
|
class Stubber:
|
71
|
-
def __init__(B,path=
|
72
|
+
def __init__(B,path=B,firmware_id=B):
|
72
73
|
C=firmware_id
|
73
74
|
try:
|
74
75
|
if os.uname().release=='1.13.0'and os.uname().version<'v1.13-103':raise k('MicroPython 1.13.0 cannot be stubbed')
|
75
76
|
except I:pass
|
76
|
-
B.info=_info();A.info('Port: {}'.format(B.info[L]));A.info('Board: {}'.format(B.info[U]));
|
77
|
+
B.info=_info();A.info('Port: {}'.format(B.info[L]));A.info('Board: {}'.format(B.info[U]));F.collect()
|
77
78
|
if C:B._fwid=C.lower()
|
78
79
|
elif B.info[S]==b:B._fwid='{family}-v{version}-{port}-{board}'.format(**B.info).rstrip(V)
|
79
80
|
else:B._fwid='{family}-v{version}-{port}'.format(**B.info)
|
80
|
-
B._start_free=
|
81
|
+
B._start_free=F.mem_free()
|
81
82
|
if path:
|
82
|
-
if path.endswith(
|
83
|
+
if path.endswith(E):path=path[:-1]
|
83
84
|
else:path=get_root()
|
84
|
-
B.path='{}/stubs/{}'.format(path,B.flat_fwid).replace('//',
|
85
|
-
try:X(path+
|
86
|
-
except
|
87
|
-
B.problematic=['upip','upysh','webrepl_setup','http_client','http_client_ssl','http_server','http_server_ssl'];B.excluded=['webrepl','_webrepl','port_diag','example_sub_led.py','example_pub_button.py'];B.modules=[];B._json_name=
|
85
|
+
B.path='{}/stubs/{}'.format(path,B.flat_fwid).replace('//',E)
|
86
|
+
try:X(path+E)
|
87
|
+
except D:A.error('error creating stub folder {}'.format(path))
|
88
|
+
B.problematic=['upip','upysh','webrepl_setup','http_client','http_client_ssl','http_server','http_server_ssl'];B.excluded=['webrepl','_webrepl','port_diag','example_sub_led.py','example_pub_button.py'];B.modules=[];B._json_name=G;B._json_first=H
|
88
89
|
def get_obj_attributes(L,item_instance):
|
89
90
|
H=item_instance;C=[];K=[]
|
90
91
|
for A in M(H):
|
91
92
|
if A.startswith('__')and not A in L.modules:continue
|
92
93
|
try:
|
93
94
|
D=getattr(H,A)
|
94
|
-
try:
|
95
|
-
except P:
|
96
|
-
if
|
97
|
-
elif
|
98
|
-
elif
|
95
|
+
try:E=Z(type(D)).split("'")[1]
|
96
|
+
except P:E=B
|
97
|
+
if E in{p,q,r,s,c,d,e}:G=1
|
98
|
+
elif E in{t,u}:G=2
|
99
|
+
elif E in'class':G=3
|
99
100
|
else:G=4
|
100
101
|
C.append((A,Z(D),Z(type(D)),D,G))
|
101
102
|
except I as J:K.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(A,H,J))
|
102
103
|
except MemoryError as J:O('MemoryError: {}'.format(J));sleep(1);reset()
|
103
|
-
C=l([A for A in C if not A[0].startswith('__')],key=lambda x:x[4]);
|
104
|
+
C=l([A for A in C if not A[0].startswith('__')],key=lambda x:x[4]);F.collect();return C,K
|
104
105
|
def add_modules(A,modules):A.modules=l(set(A.modules)|set(modules))
|
105
106
|
def create_all_stubs(B):
|
106
|
-
A.info('Start micropython-stubber {} on {}'.format(__version__,B._fwid));B.report_start();
|
107
|
+
A.info('Start micropython-stubber {} on {}'.format(__version__,B._fwid));B.report_start();F.collect()
|
107
108
|
for C in B.modules:B.create_one_stub(C)
|
108
109
|
B.report_end();A.info('Finally done')
|
109
110
|
def create_one_stub(C,module_name):
|
110
111
|
B=module_name
|
111
112
|
if B in C.problematic:A.warning('Skip module: {:<25} : Known problematic'.format(B));return H
|
112
113
|
if B in C.excluded:A.warning('Skip module: {:<25} : Excluded'.format(B));return H
|
113
|
-
I='{}/{}.pyi'.format(C.path,B.replace(K,
|
114
|
-
try:
|
115
|
-
except
|
116
|
-
|
117
|
-
def create_module_stub(J,module_name,file_name=
|
114
|
+
I='{}/{}.pyi'.format(C.path,B.replace(K,E));F.collect();G=H
|
115
|
+
try:G=C.create_module_stub(B,I)
|
116
|
+
except D:return H
|
117
|
+
F.collect();return G
|
118
|
+
def create_module_stub(J,module_name,file_name=G):
|
118
119
|
I=file_name;C=module_name
|
119
|
-
if I is
|
120
|
-
else:L=I.split(
|
121
|
-
if
|
122
|
-
M=
|
123
|
-
try:M=__import__(C,
|
120
|
+
if I is G:L=C.replace(K,'_')+'.pyi';I=J.path+E+L
|
121
|
+
else:L=I.split(E)[-1]
|
122
|
+
if E in C:C=C.replace(E,K)
|
123
|
+
M=G
|
124
|
+
try:M=__import__(C,G,G,'*');P=F.mem_free();A.info('Stub module: {:<25} to file: {:<70} mem:{:>5}'.format(C,L,P))
|
124
125
|
except N:return H
|
125
126
|
X(I)
|
126
|
-
with Q(I,'w')as O:R=str(J.info).replace('OrderedDict(',B).replace('})','}');S='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(C,J._fwid,R,__version__);O.write(S);O.write('from __future__ import annotations\nfrom typing import Any, Generator\nfrom _typeshed import Incomplete\n\n');J.write_object_stub(O,M,C,B)
|
127
|
+
with Q(I,'w')as O:R=str(J.info).replace('OrderedDict(',B).replace('})','}');S='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(C,J._fwid,R,__version__);O.write(S);O.write('from __future__ import annotations\nfrom typing import Any, Final, Generator\nfrom _typeshed import Incomplete\n\n');J.write_object_stub(O,M,C,B)
|
127
128
|
J.report_add(C,I)
|
128
129
|
if C not in{'os','sys','logging','gc'}:
|
129
130
|
try:del M
|
130
|
-
except(
|
131
|
-
|
131
|
+
except(D,m):A.warning('could not del new_module')
|
132
|
+
F.collect();return T
|
132
133
|
def write_object_stub(L,fp,object_expr,obj_name,indent,in_class=0):
|
133
|
-
|
134
|
+
Y=' at ...>';X='{0}{1}: {3} = {2}\n';W='bound_method';V='Incomplete';O=in_class;N='Exception';M=object_expr;K=' at ';J=fp;E=indent;F.collect()
|
134
135
|
if M in L.problematic:A.warning('SKIPPING problematic module:{}'.format(M));return
|
135
|
-
|
136
|
+
Z,P=L.get_obj_attributes(M)
|
136
137
|
if P:A.error(P)
|
137
|
-
for(C,H,I,
|
138
|
+
for(C,H,I,a,f)in Z:
|
138
139
|
if C in['classmethod','staticmethod','BaseException',N]:continue
|
139
140
|
if C[0].isdigit():A.warning('NameError: invalid name {}'.format(C));continue
|
140
|
-
if I=="<class 'type'>"and R(
|
141
|
+
if I=="<class 'type'>"and R(E)<=A0*4:
|
141
142
|
Q=B;S=C.endswith(N)or C.endswith('Error')or C in['KeyboardInterrupt','StopIteration','SystemExit']
|
142
143
|
if S:Q=N
|
143
|
-
D='\n{}class {}({}):\n'.format(
|
144
|
-
if S:D+=
|
145
|
-
J.write(D);L.write_object_stub(J,
|
144
|
+
D='\n{}class {}({}):\n'.format(E,C,Q)
|
145
|
+
if S:D+=E+' ...\n';J.write(D);continue
|
146
|
+
J.write(D);L.write_object_stub(J,a,'{0}.{1}'.format(obj_name,C),E+' ',O+1);D=E+' def __init__(self, *argv, **kwargs) -> None:\n';D+=E+' ...\n\n';J.write(D)
|
146
147
|
elif any(A in I for A in[u,t,'closure']):
|
147
148
|
T=V;U=B
|
148
149
|
if O>0:U='self, '
|
149
|
-
if W in I or W in H:D='{}@classmethod\n'.format(
|
150
|
-
else:D='{}def {}({}*args, **kwargs) -> {}:\n'.format(
|
151
|
-
D+=
|
150
|
+
if W in I or W in H:D='{}@classmethod\n'.format(E)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(E,C,T)
|
151
|
+
else:D='{}def {}({}*args, **kwargs) -> {}:\n'.format(E,C,U,T)
|
152
|
+
D+=E+' ...\n\n';J.write(D)
|
152
153
|
elif I=="<class 'module'>":0
|
153
154
|
elif I.startswith("<class '"):
|
154
155
|
G=I[8:-2];D=B
|
155
156
|
if G in(r,p,q,s,'bytearray','bytes'):
|
156
|
-
if C.upper()==C:D='{0}{1}: Final[{3}] = {2}\n'.format(
|
157
|
-
else:D=X.format(
|
158
|
-
elif G in(e,d,c):
|
159
|
-
elif G in('object','set','frozenset','Pin',
|
160
|
-
|
161
|
-
D='{0}{1}: {2} ## = {4}\n'.format(F,C,G,I,H)
|
157
|
+
if C.upper()==C:D='{0}{1}: Final[{3}] = {2}\n'.format(E,C,H,G)
|
158
|
+
else:D=X.format(E,C,H,G)
|
159
|
+
elif G in(e,d,c):b={e:'{}',d:'[]',c:'()'};D=X.format(E,C,b[G],G)
|
160
|
+
elif G in('object','set','frozenset','Pin'):D='{0}{1}: {2} ## = {4}\n'.format(E,C,G,I,H)
|
161
|
+
elif G=='generator':G='Generator';D='{0}def {1}(*args, **kwargs) -> Generator: ## = {4}\n{0} ...\n\n'.format(E,C,G,I,H)
|
162
162
|
else:
|
163
163
|
G=V
|
164
|
-
if K in H:H=H.split(K)[0]+
|
165
|
-
if K in H:H=H.split(K)[0]+
|
166
|
-
D='{0}{1}: {2} ## {3} = {4}\n'.format(
|
164
|
+
if K in H:H=H.split(K)[0]+Y
|
165
|
+
if K in H:H=H.split(K)[0]+Y
|
166
|
+
D='{0}{1}: {2} ## {3} = {4}\n'.format(E,C,G,I,H)
|
167
167
|
J.write(D)
|
168
|
-
else:J.write("# all other, type = '{0}'\n".format(I));J.write(
|
168
|
+
else:J.write("# all other, type = '{0}'\n".format(I));J.write(E+C+' # type: Incomplete\n')
|
169
169
|
@property
|
170
170
|
def flat_fwid(self):
|
171
171
|
A=self._fwid;B=' .()/\\:$'
|
172
172
|
for C in B:A=A.replace(C,'_')
|
173
173
|
return A
|
174
|
-
def clean(C,path=
|
175
|
-
if path
|
174
|
+
def clean(C,path=B):
|
175
|
+
if not path:path=C.path
|
176
176
|
A.info('Clean/remove files in folder: {}'.format(path))
|
177
177
|
try:os.stat(path);E=os.listdir(path)
|
178
|
-
except(
|
179
|
-
for
|
180
|
-
B=v.format(path,
|
178
|
+
except(D,I):return
|
179
|
+
for F in E:
|
180
|
+
B=v.format(path,F)
|
181
181
|
try:os.remove(B)
|
182
|
-
except
|
182
|
+
except D:
|
183
183
|
try:C.clean(B);os.rmdir(B)
|
184
|
-
except
|
184
|
+
except D:pass
|
185
185
|
def report_start(B,filename='modules.json'):
|
186
|
-
H='firmware';B._json_name=v.format(B.path,filename);B._json_first=T;X(B._json_name);A.info('Report file: {}'.format(B._json_name));
|
186
|
+
H='firmware';B._json_name=v.format(B.path,filename);B._json_first=T;X(B._json_name);A.info('Report file: {}'.format(B._json_name));F.collect()
|
187
187
|
try:
|
188
|
-
with Q(B._json_name,'w')as
|
189
|
-
except
|
188
|
+
with Q(B._json_name,'w')as E:E.write('{');E.write(dumps({H:B.info})[1:-1]);E.write(f);E.write(dumps({o:{C:__version__},'stubtype':H})[1:-1]);E.write(f);E.write('"modules" :[\n')
|
189
|
+
except D as I:A.error(w);B._json_name=G;raise I
|
190
190
|
def report_add(B,module_name,stub_file):
|
191
191
|
if not B._json_name:raise n(x)
|
192
192
|
try:
|
193
193
|
with Q(B._json_name,'a')as C:
|
194
194
|
if not B._json_first:C.write(f)
|
195
195
|
else:B._json_first=H
|
196
|
-
|
197
|
-
except
|
196
|
+
F='{{"module": "{}", "file": "{}"}}'.format(module_name,stub_file.replace('\\',E));C.write(F)
|
197
|
+
except D:A.error(w)
|
198
198
|
def report_end(B):
|
199
199
|
if not B._json_name:raise n(x)
|
200
200
|
with Q(B._json_name,'a')as C:C.write('\n]}')
|
201
201
|
A.info('Path: {}'.format(B.path))
|
202
202
|
def X(path):
|
203
|
-
B=
|
203
|
+
B=F=0
|
204
204
|
while B!=-1:
|
205
|
-
B=path.find(
|
205
|
+
B=path.find(E,F)
|
206
206
|
if B!=-1:
|
207
207
|
C=path[0]if B==0 else path[:B]
|
208
208
|
try:I=os.stat(C)
|
209
|
-
except
|
210
|
-
if
|
209
|
+
except D as G:
|
210
|
+
if G.args[0]in[y,z]:
|
211
211
|
try:A.debug('Create folder {}'.format(C));os.mkdir(C)
|
212
|
-
except
|
213
|
-
|
212
|
+
except D as H:A.error('failed to create folder {}'.format(C));raise H
|
213
|
+
F=B+1
|
214
214
|
def Y(s):
|
215
215
|
C=' on '
|
216
216
|
if not s:return B
|
@@ -221,63 +221,63 @@ def Y(s):
|
|
221
221
|
if not W in s:return B
|
222
222
|
A=s.split(W)[1].split(K)[1];return A
|
223
223
|
def _info():
|
224
|
-
c='ev3-pybricks';Z='pycom';X='pycopy';V='unix';T='win32';R='arch';Q='cpu';O='ver';
|
224
|
+
c='ev3-pybricks';Z='pycom';X='pycopy';V='unix';T='win32';R='arch';Q='cpu';O='ver';E='mpy';D='build'
|
225
225
|
try:J=sys.implementation[0]
|
226
226
|
except a:J=sys.implementation.name
|
227
|
-
A=g({S:J,C:B,
|
227
|
+
A=g({S:J,C:B,D:B,O:B,L:sys.platform,U:'UNKNOWN',Q:B,E:B,R:B})
|
228
228
|
if A[L].startswith('pyb'):A[L]='stm32'
|
229
229
|
elif A[L]==T:A[L]='windows'
|
230
230
|
elif A[L]=='linux':A[L]=V
|
231
|
-
try:A[C]=
|
231
|
+
try:A[C]=A2(sys.implementation.version)
|
232
232
|
except I:pass
|
233
|
-
try:K=sys.implementation._machine if'_machine'in M(sys.implementation)else os.uname().machine;A[U]=K;A[Q]=K.split('with')[-1].strip();A[
|
233
|
+
try:K=sys.implementation._machine if'_machine'in M(sys.implementation)else os.uname().machine;A[U]=K;A[Q]=K.split('with')[-1].strip();A[E]=sys.implementation._mpy if'_mpy'in M(sys.implementation)else sys.implementation.mpy if E in M(sys.implementation)else B
|
234
234
|
except(I,P):pass
|
235
|
-
A[U]=
|
235
|
+
A[U]=A3()
|
236
236
|
try:
|
237
237
|
if'uname'in M(os):
|
238
|
-
A[
|
239
|
-
if not A[
|
240
|
-
elif C in M(sys):A[
|
238
|
+
A[D]=Y(os.uname()[3])
|
239
|
+
if not A[D]:A[D]=Y(os.uname()[2])
|
240
|
+
elif C in M(sys):A[D]=Y(sys.version)
|
241
241
|
except(I,P,a):pass
|
242
242
|
if A[C]==B and sys.platform not in(V,T):
|
243
243
|
try:d=os.uname();A[C]=d.release
|
244
244
|
except(P,I,a):pass
|
245
245
|
for(e,f,h)in[(X,X,'const'),(Z,Z,'FAT'),(c,'pybricks.hubs','EV3Brick')]:
|
246
|
-
try:i=__import__(f,
|
246
|
+
try:i=__import__(f,G,G,h);A[S]=e;del i;break
|
247
247
|
except(N,m):pass
|
248
248
|
if A[S]==c:A['release']='2.0.0'
|
249
249
|
if A[S]==b:
|
250
250
|
A[C]
|
251
251
|
if A[C]and A[C].endswith('.0')and A[C]>='1.10.0'and A[C]<='1.19.9':A[C]=A[C][:-2]
|
252
|
-
if
|
253
|
-
|
254
|
-
try:H=[
|
252
|
+
if E in A and A[E]:
|
253
|
+
F=int(A[E])
|
254
|
+
try:H=[G,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin','rv32imc'][F>>10]
|
255
255
|
except P:H='unknown'
|
256
256
|
if H:A[R]=H
|
257
|
-
A[
|
258
|
-
if A[
|
259
|
-
A[O]=f"{A[C]}-{A[
|
260
|
-
def
|
257
|
+
A[E]='v{}.{}'.format(F&255,F>>8&3)
|
258
|
+
if A[D]and not A[C].endswith(W):A[C]=A[C]+W
|
259
|
+
A[O]=f"{A[C]}-{A[D]}"if A[D]else f"{A[C]}";return A
|
260
|
+
def A2(version):
|
261
261
|
A=version;B=K.join([str(A)for A in A[:3]])
|
262
262
|
if R(A)>3 and A[3]:B+=V+A[3]
|
263
263
|
return B
|
264
|
-
def
|
264
|
+
def A3():
|
265
265
|
try:from boardname import BOARDNAME as C;A.info('Found BOARDNAME: {}'.format(C))
|
266
266
|
except N:A.warning('BOARDNAME not found');C=B
|
267
267
|
return C
|
268
268
|
def get_root():
|
269
269
|
try:A=os.getcwd()
|
270
|
-
except(
|
270
|
+
except(D,I):A=K
|
271
271
|
B=A
|
272
|
-
for B in['/remote','/sd','/flash',
|
272
|
+
for B in['/remote','/sd','/flash',E,A,K]:
|
273
273
|
try:C=os.stat(B);break
|
274
|
-
except
|
274
|
+
except D:continue
|
275
275
|
return B
|
276
276
|
def h(filename):
|
277
277
|
try:
|
278
278
|
if os.stat(filename)[0]>>14:return T
|
279
279
|
return H
|
280
|
-
except
|
280
|
+
except D:return H
|
281
281
|
def i():O("-p, --path path to store the stubs in, defaults to '.'");sys.exit(1)
|
282
282
|
def read_path():
|
283
283
|
path=B
|
@@ -293,8 +293,8 @@ def j():
|
|
293
293
|
def main():
|
294
294
|
stubber=Stubber(path=read_path());stubber.clean()
|
295
295
|
def A(stubber):
|
296
|
-
|
297
|
-
for C in
|
296
|
+
F.collect();stubber.modules=[]
|
297
|
+
for C in A1:
|
298
298
|
B=C+'/modulelist.txt'
|
299
299
|
if not h(B):continue
|
300
300
|
with Q(B)as D:
|
@@ -302,13 +302,13 @@ def main():
|
|
302
302
|
A=D.readline().strip()
|
303
303
|
if not A:break
|
304
304
|
if R(A)>0 and A[0]!='#':stubber.modules.append(A)
|
305
|
-
|
305
|
+
F.collect();O('BREAK');break
|
306
306
|
if not stubber.modules:stubber.modules=[b]
|
307
|
-
|
308
|
-
stubber.modules=[];A(stubber);
|
307
|
+
F.collect()
|
308
|
+
stubber.modules=[];A(stubber);F.collect();stubber.create_all_stubs()
|
309
309
|
if __name__=='__main__'or j():
|
310
310
|
if not h('no_auto_stubber.txt'):
|
311
311
|
O(f"createstubs.py: {__version__}")
|
312
|
-
try:
|
312
|
+
try:F.threshold(4096);F.enable()
|
313
313
|
except BaseException:pass
|
314
314
|
main()
|
Binary file
|