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