micropython-stubber 1.14.1__py3-none-any.whl → 1.15.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.15.1.dist-info/METADATA +244 -0
- {micropython_stubber-1.14.1.dist-info → micropython_stubber-1.15.1.dist-info}/RECORD +49 -46
- stubber/__init__.py +1 -1
- stubber/basicgit.py +27 -14
- stubber/board/createstubs.py +34 -36
- stubber/board/createstubs_db.py +35 -35
- stubber/board/createstubs_db_min.py +195 -193
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_info.py +73 -42
- stubber/board/createstubs_lvgl.py +35 -35
- stubber/board/createstubs_lvgl_min.py +88 -87
- stubber/board/createstubs_lvgl_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +44 -40
- stubber/board/createstubs_mem_min.py +179 -174
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +75 -74
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/board/info.py +183 -0
- stubber/codemod/enrich.py +28 -16
- stubber/commands/build_cmd.py +3 -3
- stubber/commands/get_core_cmd.py +17 -5
- stubber/commands/get_docstubs_cmd.py +23 -8
- stubber/commands/get_frozen_cmd.py +62 -9
- stubber/commands/get_lobo_cmd.py +13 -3
- stubber/commands/merge_cmd.py +7 -4
- stubber/commands/publish_cmd.py +5 -4
- stubber/commands/stub_cmd.py +2 -1
- stubber/commands/variants_cmd.py +0 -1
- stubber/freeze/common.py +2 -2
- stubber/freeze/freeze_folder.py +1 -1
- stubber/freeze/get_frozen.py +1 -1
- stubber/minify.py +43 -28
- stubber/publish/bump.py +1 -1
- stubber/publish/candidates.py +61 -17
- stubber/publish/defaults.py +44 -0
- stubber/publish/merge_docstubs.py +19 -56
- stubber/publish/package.py +44 -37
- stubber/publish/pathnames.py +51 -0
- stubber/publish/publish.py +5 -4
- stubber/publish/stubpacker.py +55 -33
- stubber/rst/lookup.py +7 -16
- stubber/rst/reader.py +39 -8
- stubber/stubs_from_docs.py +5 -8
- stubber/utils/post.py +34 -40
- stubber/utils/repos.py +32 -17
- stubber/utils/stubmaker.py +22 -14
- micropython_stubber-1.14.1.dist-info/METADATA +0 -217
- {micropython_stubber-1.14.1.dist-info → micropython_stubber-1.15.1.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.14.1.dist-info → micropython_stubber-1.15.1.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.14.1.dist-info → micropython_stubber-1.15.1.dist-info}/entry_points.txt +0 -0
@@ -1,20 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
1
|
+
w='{}/{}'
|
2
|
+
v='method'
|
3
|
+
u='function'
|
4
|
+
t='bool'
|
5
|
+
s='str'
|
6
|
+
r='float'
|
7
|
+
q='int'
|
8
|
+
p='port'
|
9
|
+
o=NameError
|
10
|
+
n=sorted
|
11
|
+
m=MemoryError
|
12
|
+
l=NotImplementedError
|
13
|
+
c=',\n'
|
14
|
+
b='dict'
|
15
|
+
a='list'
|
16
|
+
Z='tuple'
|
17
|
+
Y='micropython'
|
18
|
+
X='stubber'
|
18
19
|
W=str
|
19
20
|
V=repr
|
20
21
|
T='_'
|
@@ -28,274 +29,275 @@ M='.'
|
|
28
29
|
L=len
|
29
30
|
K='board'
|
30
31
|
J=open
|
31
|
-
I=
|
32
|
-
H=
|
32
|
+
I=AttributeError
|
33
|
+
H=print
|
33
34
|
G='/'
|
34
|
-
|
35
|
+
A=False
|
36
|
+
F='version'
|
35
37
|
E=None
|
36
|
-
D=
|
37
|
-
A=OSError
|
38
|
+
D=OSError
|
38
39
|
C=''
|
39
40
|
import gc as B,os,sys
|
40
|
-
from ujson import dumps as
|
41
|
+
from ujson import dumps as d
|
41
42
|
try:from machine import reset
|
42
43
|
except P:pass
|
43
|
-
try:from collections import OrderedDict as
|
44
|
-
except P:from ucollections import OrderedDict as
|
45
|
-
__version__='v1.
|
46
|
-
w=2
|
44
|
+
try:from collections import OrderedDict as e
|
45
|
+
except P:from ucollections import OrderedDict as e
|
46
|
+
__version__='v1.15.1'
|
47
47
|
x=2
|
48
|
-
|
48
|
+
y=2
|
49
|
+
f=[M,'/lib','/sd/lib','/flash/lib','lib']
|
49
50
|
from time import sleep
|
50
51
|
class Stubber:
|
51
|
-
def __init__(
|
52
|
-
|
52
|
+
def __init__(A,path=E,firmware_id=E):
|
53
|
+
C=firmware_id
|
53
54
|
try:
|
54
|
-
if os.uname().release=='1.13.0'and os.uname().version<'v1.13-103':raise
|
55
|
-
except
|
56
|
-
|
57
|
-
if
|
58
|
-
elif
|
59
|
-
else:
|
60
|
-
|
55
|
+
if os.uname().release=='1.13.0'and os.uname().version<'v1.13-103':raise l('MicroPython 1.13.0 cannot be stubbed')
|
56
|
+
except I:pass
|
57
|
+
A.log=E;A.log=logging.getLogger(X);A._report=[];A.info=_info();H('Port: {}'.format(A.info[p]));H('Board: {}'.format(A.info[K]));B.collect()
|
58
|
+
if C:A._fwid=C.lower()
|
59
|
+
elif A.info[O]==Y:A._fwid='{family}-{ver}-{port}-{board}'.format(**A.info)
|
60
|
+
else:A._fwid='{family}-{ver}-{port}'.format(**A.info)
|
61
|
+
A._start_free=B.mem_free()
|
61
62
|
if path:
|
62
63
|
if path.endswith(G):path=path[:-1]
|
63
64
|
else:path=get_root()
|
64
|
-
|
65
|
-
try:
|
66
|
-
except
|
67
|
-
|
65
|
+
A.path='{}/stubs/{}'.format(path,A.flat_fwid).replace('//',G)
|
66
|
+
try:g(path+G)
|
67
|
+
except D:H('error creating stub folder {}'.format(path))
|
68
|
+
A.problematic=['upip','upysh','webrepl_setup','http_client','http_client_ssl','http_server','http_server_ssl'];A.excluded=['webrepl','_webrepl','port_diag','example_sub_led.py','example_pub_button.py'];A.modules=[]
|
68
69
|
def get_obj_attributes(L,item_instance):
|
69
|
-
|
70
|
-
for A in Q(
|
70
|
+
H=item_instance;D=[];J=[]
|
71
|
+
for A in Q(H):
|
71
72
|
if A.startswith(T)and not A in L.modules:continue
|
72
73
|
try:
|
73
|
-
E=getattr(
|
74
|
+
E=getattr(H,A)
|
74
75
|
try:F=V(type(E)).split("'")[1]
|
75
76
|
except R:F=C
|
76
|
-
if F in{
|
77
|
-
elif F in{
|
77
|
+
if F in{q,r,s,t,Z,a,b}:G=1
|
78
|
+
elif F in{u,v}:G=2
|
78
79
|
elif F in'class':G=3
|
79
80
|
else:G=4
|
80
81
|
D.append((A,V(E),V(type(E)),E,G))
|
81
|
-
except
|
82
|
-
except
|
83
|
-
D=
|
84
|
-
def add_modules(A,modules):A.modules=
|
82
|
+
except I as K:J.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(A,H,K))
|
83
|
+
except m as K:sleep(1);reset()
|
84
|
+
D=n([A for A in D if not A[0].startswith('__')],key=lambda x:x[4]);B.collect();return D,J
|
85
|
+
def add_modules(A,modules):A.modules=n(set(A.modules)|set(modules))
|
85
86
|
def create_all_stubs(A):
|
86
87
|
B.collect()
|
87
88
|
for C in A.modules:A.create_one_stub(C)
|
88
89
|
def create_one_stub(C,module_name):
|
89
|
-
|
90
|
-
if
|
91
|
-
if
|
92
|
-
H='{}/{}.py'.format(C.path,
|
93
|
-
try:
|
94
|
-
except
|
95
|
-
B.collect();return
|
90
|
+
E=module_name
|
91
|
+
if E in C.problematic:return A
|
92
|
+
if E in C.excluded:return A
|
93
|
+
H='{}/{}.py'.format(C.path,E.replace(M,G));B.collect();F=A
|
94
|
+
try:F=C.create_module_stub(E,H)
|
95
|
+
except D:return A
|
96
|
+
B.collect();return F
|
96
97
|
def create_module_stub(K,module_name,file_name=E):
|
97
|
-
|
98
|
-
if
|
99
|
-
else:L=
|
100
|
-
if G in
|
98
|
+
I=file_name;F=module_name
|
99
|
+
if I is E:L=F.replace(M,T)+'.py';I=K.path+G+L
|
100
|
+
else:L=I.split(G)[-1]
|
101
|
+
if G in F:F=F.replace(G,M)
|
101
102
|
O=E
|
102
|
-
try:O=__import__(
|
103
|
-
except P:return
|
104
|
-
|
105
|
-
with J(
|
106
|
-
K._report.append('{{"module": "{}", "file": "{}"}}'.format(
|
107
|
-
if
|
103
|
+
try:O=__import__(F,E,E,'*');R=B.mem_free();H('Stub module: {:<25} to file: {:<70} mem:{:>5}'.format(F,L,R))
|
104
|
+
except P:return A
|
105
|
+
g(I)
|
106
|
+
with J(I,'w')as Q:U=W(K.info).replace('OrderedDict(',C).replace('})','}');V='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(F,K._fwid,U,__version__);Q.write(V);Q.write('from typing import Any\nfrom _typeshed import Incomplete\n\n');K.write_object_stub(Q,O,F,C)
|
107
|
+
K._report.append('{{"module": "{}", "file": "{}"}}'.format(F,I.replace('\\',G)))
|
108
|
+
if F not in{'os','sys','logging','gc'}:
|
108
109
|
try:del O
|
109
|
-
except (
|
110
|
-
try:del sys.modules[
|
110
|
+
except (D,S):pass
|
111
|
+
try:del sys.modules[F]
|
111
112
|
except S:pass
|
112
113
|
B.collect();return N
|
113
114
|
def write_object_stub(M,fp,object_expr,obj_name,indent,in_class=0):
|
114
|
-
d='{0}{1} = {2} # type: {3}\n';c='bound_method';
|
115
|
+
d='{0}{1} = {2} # type: {3}\n';c='bound_method';Y='Incomplete';Q=in_class;P=object_expr;O='Exception';I=fp;E=indent;B.collect()
|
115
116
|
if P in M.problematic:return
|
116
117
|
R,N=M.get_obj_attributes(P)
|
117
|
-
if N:
|
118
|
+
if N:H(N)
|
118
119
|
for (F,K,G,T,f) in R:
|
119
120
|
if F in['classmethod','staticmethod','BaseException',O]:continue
|
120
121
|
if F[0].isdigit():continue
|
121
|
-
if G=="<class 'type'>"and L(E)<=
|
122
|
+
if G=="<class 'type'>"and L(E)<=y*4:
|
122
123
|
U=C;V=F.endswith(O)or F.endswith('Error')or F in['KeyboardInterrupt','StopIteration','SystemExit']
|
123
124
|
if V:U=O
|
124
|
-
|
125
|
-
if V:
|
126
|
-
|
127
|
-
elif any((A in G for A in[u,
|
128
|
-
W=
|
125
|
+
A='\n{}class {}({}):\n'.format(E,F,U)
|
126
|
+
if V:A+=E+' ...\n';I.write(A);return
|
127
|
+
I.write(A);M.write_object_stub(I,T,'{0}.{1}'.format(obj_name,F),E+' ',Q+1);A=E+' def __init__(self, *argv, **kwargs) -> None:\n';A+=E+' ...\n\n';I.write(A)
|
128
|
+
elif any((A in G for A in[v,u,'closure'])):
|
129
|
+
W=Y;X=C
|
129
130
|
if Q>0:X='self, '
|
130
|
-
if c in G or c in K:
|
131
|
-
else:
|
132
|
-
|
131
|
+
if c in G or c in K:A='{}@classmethod\n'.format(E)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(E,F,W)
|
132
|
+
else:A='{}def {}({}*args, **kwargs) -> {}:\n'.format(E,F,X,W)
|
133
|
+
A+=E+' ...\n\n';I.write(A)
|
133
134
|
elif G=="<class 'module'>":0
|
134
135
|
elif G.startswith("<class '"):
|
135
|
-
J=G[8:-2];
|
136
|
-
if J in[
|
137
|
-
elif J in[a,Z
|
136
|
+
J=G[8:-2];A=C
|
137
|
+
if J in[s,q,r,t,'bytearray','bytes']:A=d.format(E,F,K,J)
|
138
|
+
elif J in[b,a,Z]:e={b:'{}',a:'[]',Z:'()'};A=d.format(E,F,e[J],J)
|
138
139
|
else:
|
139
|
-
if J not in['object','set','frozenset']:J=
|
140
|
-
|
141
|
-
|
142
|
-
else:
|
140
|
+
if J not in['object','set','frozenset']:J=Y
|
141
|
+
A='{0}{1} : {2} ## {3} = {4}\n'.format(E,F,J,G,K)
|
142
|
+
I.write(A)
|
143
|
+
else:I.write("# all other, type = '{0}'\n".format(G));I.write(E+F+' # type: Incomplete\n')
|
143
144
|
del R;del N
|
144
145
|
try:del F,K,G,T
|
145
|
-
except (
|
146
|
+
except (D,S,o):pass
|
146
147
|
@property
|
147
148
|
def flat_fwid(self):
|
148
149
|
A=self._fwid;B=' .()/\\:$'
|
149
150
|
for C in B:A=A.replace(C,T)
|
150
151
|
return A
|
151
|
-
def clean(
|
152
|
-
if path is E:path=
|
153
|
-
|
154
|
-
try:os.stat(path);
|
155
|
-
except (
|
156
|
-
for F in
|
157
|
-
|
158
|
-
try:os.remove(
|
159
|
-
except
|
160
|
-
try:
|
161
|
-
except
|
152
|
+
def clean(B,path=E):
|
153
|
+
if path is E:path=B.path
|
154
|
+
H('Clean/remove files in folder: {}'.format(path))
|
155
|
+
try:os.stat(path);C=os.listdir(path)
|
156
|
+
except (D,I):return
|
157
|
+
for F in C:
|
158
|
+
A=w.format(path,F)
|
159
|
+
try:os.remove(A)
|
160
|
+
except D:
|
161
|
+
try:B.clean(A);os.rmdir(A)
|
162
|
+
except D:pass
|
162
163
|
def report(C,filename='modules.json'):
|
163
|
-
|
164
|
+
H('Created stubs for {} modules on board {}\nPath: {}'.format(L(C._report),C._fwid,C.path));G=w.format(C.path,filename);B.collect()
|
164
165
|
try:
|
165
|
-
with J(G,'w')as
|
166
|
-
C.write_json_header(
|
167
|
-
for
|
168
|
-
C.write_json_end(
|
166
|
+
with J(G,'w')as E:
|
167
|
+
C.write_json_header(E);F=N
|
168
|
+
for I in C._report:C.write_json_node(E,I,F);F=A
|
169
|
+
C.write_json_end(E)
|
169
170
|
K=C._start_free-B.mem_free()
|
170
|
-
except
|
171
|
-
def write_json_header(B,f):A='firmware';f.write('{');f.write(
|
171
|
+
except D:H('Failed to create the report.')
|
172
|
+
def write_json_header(B,f):A='firmware';f.write('{');f.write(d({A:B.info})[1:-1]);f.write(c);f.write(d({X:{F:__version__},'stubtype':A})[1:-1]);f.write(c);f.write('"modules" :[\n')
|
172
173
|
def write_json_node(A,f,n,first):
|
173
|
-
if not first:f.write(
|
174
|
+
if not first:f.write(c)
|
174
175
|
f.write(n)
|
175
176
|
def write_json_end(A,f):f.write('\n]}')
|
176
|
-
def
|
177
|
-
|
178
|
-
while
|
179
|
-
|
180
|
-
if
|
181
|
-
|
182
|
-
try:
|
183
|
-
except
|
184
|
-
if E.args[0]==
|
185
|
-
try:os.mkdir(
|
186
|
-
except
|
187
|
-
|
177
|
+
def g(path):
|
178
|
+
A=C=0
|
179
|
+
while A!=-1:
|
180
|
+
A=path.find(G,C)
|
181
|
+
if A!=-1:
|
182
|
+
B=path[0]if A==0 else path[:A]
|
183
|
+
try:I=os.stat(B)
|
184
|
+
except D as E:
|
185
|
+
if E.args[0]==x:
|
186
|
+
try:os.mkdir(B)
|
187
|
+
except D as F:H('failed to create folder {}'.format(B));raise F
|
188
|
+
C=A+1
|
188
189
|
def U(s):
|
189
190
|
A=' on '
|
190
191
|
if not s:return C
|
191
192
|
if A in s:s=s.split(A,1)[0]
|
192
193
|
return s.split('-')[1]if'-'in s else C
|
193
194
|
def _info():
|
194
|
-
k='ev3-pybricks';j='pycom';
|
195
|
-
try:A[
|
196
|
-
except
|
197
|
-
try:
|
198
|
-
except (
|
195
|
+
k='ev3-pybricks';j='pycom';g='pycopy';d='GENERIC';c='arch';b='cpu';a='ver';V='with';G='mpy';D='build';A=e({O:sys.implementation.name,F:C,D:C,a:C,p:'stm32'if sys.platform.startswith('pyb')else sys.platform,K:d,b:C,G:C,c:C})
|
196
|
+
try:A[F]=M.join([W(A)for A in sys.implementation.version])
|
197
|
+
except I:pass
|
198
|
+
try:X=sys.implementation._machine if'_machine'in Q(sys.implementation)else os.uname().machine;A[K]=X.strip();A[b]=X.split(V)[1].strip();A[G]=sys.implementation._mpy if'_mpy'in Q(sys.implementation)else sys.implementation.mpy if G in Q(sys.implementation)else C
|
199
|
+
except (I,R):pass
|
199
200
|
B.collect()
|
200
|
-
for J in [A+'/board_info.csv'for A in
|
201
|
-
if
|
202
|
-
|
203
|
-
if
|
204
|
-
if V in
|
205
|
-
|
206
|
-
if
|
207
|
-
A[K]=
|
201
|
+
for J in [A+'/board_info.csv'for A in f]:
|
202
|
+
if i(J):
|
203
|
+
H=A[K].strip()
|
204
|
+
if h(A,H,J):break
|
205
|
+
if V in H:
|
206
|
+
H=H.split(V)[0].strip()
|
207
|
+
if h(A,H,J):break
|
208
|
+
A[K]=d
|
208
209
|
A[K]=A[K].replace(' ',T);B.collect()
|
209
210
|
try:
|
210
|
-
A[
|
211
|
-
if not A[
|
212
|
-
if not A[
|
213
|
-
except (
|
214
|
-
if A[
|
215
|
-
if A[
|
216
|
-
try:l=os.uname();A[
|
217
|
-
except (R,
|
218
|
-
for (m,n,
|
219
|
-
try:q=__import__(n,E,E,
|
211
|
+
A[D]=U(os.uname()[3])
|
212
|
+
if not A[D]:A[D]=U(os.uname()[2])
|
213
|
+
if not A[D]and';'in sys.version:A[D]=U(sys.version.split(';')[1])
|
214
|
+
except (I,R):pass
|
215
|
+
if A[D]and L(A[D])>5:A[D]=C
|
216
|
+
if A[F]==C and sys.platform not in('unix','win32'):
|
217
|
+
try:l=os.uname();A[F]=l.release
|
218
|
+
except (R,I,TypeError):pass
|
219
|
+
for (m,n,o) in [(g,g,'const'),(j,j,'FAT'),(k,'pybricks.hubs','EV3Brick')]:
|
220
|
+
try:q=__import__(n,E,E,o);A[O]=m;del q;break
|
220
221
|
except (P,S):pass
|
221
222
|
if A[O]==k:A['release']='2.0.0'
|
222
|
-
if A[O]==
|
223
|
-
if A[
|
223
|
+
if A[O]==Y:
|
224
|
+
if A[F]and A[F].endswith('.0')and A[F]>='1.10.0'and A[F]<='1.19.9':A[F]=A[F][:-2]
|
224
225
|
if G in A and A[G]:
|
225
226
|
N=int(A[G]);Z=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][N>>10]
|
226
227
|
if Z:A[c]=Z
|
227
228
|
A[G]='v{}.{}'.format(N&255,N>>8&3)
|
228
|
-
A[a]=f"v{A[
|
229
|
-
def
|
230
|
-
with J(filename,'r')as
|
229
|
+
A[a]=f"v{A[F]}-{A[D]}"if A[D]else f"v{A[F]}";return A
|
230
|
+
def h(info,board_descr,filename):
|
231
|
+
with J(filename,'r')as C:
|
231
232
|
while 1:
|
232
|
-
|
233
|
-
if not
|
234
|
-
|
235
|
-
if
|
236
|
-
return
|
233
|
+
B=C.readline()
|
234
|
+
if not B:break
|
235
|
+
D,E=B.split(',')[0].strip(),B.split(',')[1].strip()
|
236
|
+
if D==board_descr:info[K]=E;return N
|
237
|
+
return A
|
237
238
|
def get_root():
|
238
|
-
try:
|
239
|
-
except (
|
240
|
-
|
241
|
-
for
|
242
|
-
try:
|
243
|
-
except
|
244
|
-
return
|
245
|
-
def
|
239
|
+
try:A=os.getcwd()
|
240
|
+
except (D,I):A=M
|
241
|
+
B=A
|
242
|
+
for B in [A,'/sd','/flash',G,M]:
|
243
|
+
try:C=os.stat(B);break
|
244
|
+
except D:continue
|
245
|
+
return B
|
246
|
+
def i(filename):
|
246
247
|
try:
|
247
248
|
if os.stat(filename)[0]>>14:return N
|
248
|
-
return
|
249
|
-
except
|
250
|
-
def
|
249
|
+
return A
|
250
|
+
except D:return A
|
251
|
+
def j():sys.exit(1)
|
251
252
|
def read_path():
|
252
253
|
path=C
|
253
254
|
if L(sys.argv)==3:
|
254
255
|
A=sys.argv[1].lower()
|
255
256
|
if A in('--path','-p'):path=sys.argv[2]
|
256
|
-
else:
|
257
|
-
elif L(sys.argv)==2:
|
257
|
+
else:j()
|
258
|
+
elif L(sys.argv)==2:j()
|
258
259
|
return path
|
259
|
-
def
|
260
|
-
try:
|
261
|
-
except (
|
260
|
+
def k():
|
261
|
+
try:B=bytes('abc',encoding='utf8');C=k.__module__;return A
|
262
|
+
except (l,I):return N
|
262
263
|
def main():
|
263
264
|
K='failed';G='modulelist.done';import machine as O
|
264
|
-
try:C=J(G,'r+b');M=N
|
265
|
-
except
|
265
|
+
try:C=J(G,'r+b');M=N;_log.info('Opened existing db')
|
266
|
+
except D:C=J(G,'w+b');_log.info('created new db');M=A
|
266
267
|
stubber=Stubber(path=read_path())
|
267
268
|
if not M:stubber.clean()
|
268
|
-
|
269
|
+
z(stubber);E={}
|
269
270
|
try:
|
270
271
|
with J(G)as C:
|
271
|
-
for
|
272
|
-
|
273
|
-
if L(
|
274
|
-
except (
|
275
|
-
B.collect();R=[A for A in stubber.modules if A not in
|
272
|
+
for F in C.read().split('\n'):
|
273
|
+
F=F.strip();B.collect()
|
274
|
+
if L(F)>0:P,Q=F.split('=',1);E[P]=Q
|
275
|
+
except (D,SyntaxError):pass
|
276
|
+
B.collect();R=[A for A in stubber.modules if A not in E.keys()];B.collect()
|
276
277
|
for H in R:
|
277
|
-
I=
|
278
|
+
I=A
|
278
279
|
try:I=stubber.create_one_stub(H)
|
279
|
-
except
|
280
|
-
B.collect();
|
280
|
+
except m:O.reset()
|
281
|
+
B.collect();E[H]=W(stubber._report[-1]if I else K)
|
281
282
|
with J(G,'a')as C:C.write('{}={}\n'.format(H,'ok'if I else K))
|
282
|
-
if
|
283
|
-
def
|
284
|
-
stubber.modules=[]
|
285
|
-
for
|
283
|
+
if E:stubber._report=[A for(B,A)in E.items()if A!=K];stubber.report()
|
284
|
+
def z(stubber):
|
285
|
+
E='/modulelist.txt';stubber.modules=[]
|
286
|
+
for C in f:
|
286
287
|
try:
|
287
|
-
with J(
|
288
|
-
|
289
|
-
|
290
|
-
|
288
|
+
with J(C+E)as F:
|
289
|
+
H('DEBUG: list of modules: '+C+E)
|
290
|
+
for A in F.read().split('\n'):
|
291
|
+
A=A.strip()
|
292
|
+
if L(A)>0 and A[0]!='#':stubber.modules.append(A)
|
291
293
|
B.collect();break
|
292
|
-
except
|
293
|
-
if not stubber.modules:stubber.modules=[
|
294
|
+
except D:pass
|
295
|
+
if not stubber.modules:stubber.modules=[Y];_log.warn('Could not find modulelist.txt, using default modules')
|
294
296
|
B.collect()
|
295
|
-
if __name__=='__main__'or
|
296
|
-
try:logging.basicConfig(level=logging.INFO)
|
297
|
-
except
|
298
|
-
if not
|
297
|
+
if __name__=='__main__'or k():
|
298
|
+
try:A0=logging.getLogger(X);logging.basicConfig(level=logging.INFO)
|
299
|
+
except o:pass
|
300
|
+
if not i('no_auto_stubber.txt'):
|
299
301
|
try:B.threshold(4*1024);B.enable()
|
300
302
|
except BaseException:pass
|
301
303
|
main()
|
Binary file
|