Skip to content

Commit f4ba778

Browse files
committed
Add how-to diagraphs
1 parent 0507dc3 commit f4ba778

File tree

2 files changed

+361
-10
lines changed

2 files changed

+361
-10
lines changed

pyarmor/learn/en/how-to.rst

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,87 @@ Build Issues
2525
How to fix issues when generating obfuscated scripts
2626
----------------------------------------------------
2727

28+
.. graphviz::
29+
:caption: Fix generating obfuscated scripts issues
30+
:align: center
31+
:name: graph-generate-script-issue
32+
33+
digraph G {
34+
node [shape=box, style=rounded]
35+
36+
start [shape="doublecircle", label="",
37+
style="filled", fillcolor="wheat"]
38+
39+
subgraph P0 {
40+
rankdir="TB"
41+
style="setlinewidth(0)"
42+
43+
s1 [label="Error: update license token failed"]
44+
s2 [label="Error: out of license"]
45+
s3 [label="Try to obfuscate hello-world script"]
46+
s4 [label="Try to obfuscate by default options"]
47+
s5 [label="Remove local configuration\nRename .pyarmor/config\nTry to obfuscate the script"]
48+
49+
s31 [label="Comment some lines in script\nFind exact problem lines"]
50+
}
51+
52+
subgraph P1 {
53+
node [
54+
style="filled,rounded",
55+
fillcolor="burlywood",
56+
]
57+
58+
n1 [href="https://pyarmor.readthedocs.io/en/latest/reference/solutions.html#fix-register-issue"
59+
label="Please check how to fix registering issues"]
60+
n2 [href="https://pyarmor.readthedocs.io/en/latest/licenses.html"
61+
label="Please check Pyarmor Licenses"]
62+
n3 [href="https://github.com/dashingsoft/pyarmor/issues"
63+
label="Reprot issue in Github\nThe minimum options to reproduce the bug\nCode snapshort which results in problem\nFull traceback"]
64+
n4 [href="https://pyarmor.readthedocs.io/en/latest/reference/man.html#pyarmor-gen"
65+
label="Please check Pyarmor man page\nUnderstand the right usage for each option"]
66+
n5 [href="https://pyarmor.readthedocs.io/en/latest/reference/solutions.html#fix-bootstrap-issue"
67+
label="Please check how to fix Pyarmor bootstrap issuses"]
68+
nr [href="https://github.com/dashingsoft/pyarmor/issues"
69+
label="Report issue in Github\nThe minimum options to reproduce this issue\nThe simplest script without third-party package"]
70+
}
71+
72+
start -> s1 -> s2 -> s3 -> s4 -> s5 -> nr
73+
s31 -> n3
74+
75+
edge [tailport=se]
76+
s1 -> n1 [label="Yes"]
77+
s2 -> n2 [label="Yes"]
78+
s3 -> s31 [label="Works"]
79+
s4 -> n4 [label="Works"]
80+
s5 -> n5 [label="Error"]
81+
}
82+
2883
.. _pack-script-issue:
2984

3085
How to fix issues when packing obfuscated scripts
3186
-------------------------------------------------
3287

88+
.. graphviz::
89+
:caption: Fix packing script issues
90+
:align: center
91+
:name: graph-pack-script-issue
92+
93+
digraph G {
94+
node [shape=box, style=rounded]
95+
96+
start [shape="doublecircle", label="",
97+
style="filled", fillcolor="wheat"]
98+
99+
s1 [label="Do not obfuscate the scripts\nPack plain scripts by PyInstaller directly\nMake sure the final bundle works"]
100+
s2 [label="Do not use option --pack\nOnly obfuscate the scripts\nMake sure it works"]
101+
s3 [style="filled,rounded",
102+
fillcolor="burlywood",
103+
href="https://pyarmor.readthedocs.io/en/latest/topic/repack.html"
104+
label="Please check topic `insight into packing`"]
105+
106+
start -> s1 -> s2 -> s3
107+
}
108+
33109
.. _how-fix-runtime-issue:
34110

35111
Runtime Issues
@@ -40,7 +116,183 @@ Runtime Issues
40116
How to fix issues when executing obfuscated script
41117
--------------------------------------------------
42118

119+
.. graphviz::
120+
:caption: Fix issues when executing obfuscated script
121+
:align: center
122+
:name: graph-run-obfuscated-script-issue
123+
124+
digraph G {
125+
node [shape=box, style=rounded]
126+
127+
start [shape="doublecircle", label="",
128+
style="filled", fillcolor="wheat"]
129+
130+
subgraph P0 {
131+
rankdir="TB"
132+
style="setlinewidth(0)"
133+
134+
s1 [label="Is build device same as target device?"]
135+
s2 [label="Is Python major.minor version to obfuscate the script same as\nPyarmor major.minor version to run the obfuscated scripts?"]
136+
s3 [label="Is it raising exception message?"]
137+
s4 [label="If RFT mode is enabled\nTry to disable RFT mode\nDoes it work?"]
138+
s5 [label="If BCC mode is enabled\nTry to disable BCC mode\nDoes it work?"]
139+
s6 [label="If any restrict options are used\nTry to remove these options\nDoes it work?"]
140+
s7 [label="If any third-party library is used\nTry to test one hello-world script\nDoes it work"]
141+
s8 [label="If Python is alpha or rc version\nTry to upgrade Python"]
142+
143+
s1 -> s2 -> s3
144+
s4 -> s5 -> s6 -> s7 -> s8
145+
}
146+
147+
start -> s1
148+
149+
subgraph P1 {
150+
node [
151+
style="filled,rounded",
152+
fillcolor="burlywood",
153+
]
154+
n1 [
155+
href="https://pyarmor.readthedocs.io/en/latest/tutorial/advanced.html#generating-cross-platform-scripts"
156+
label="Please check cross-platform solutions"]
157+
n2 [
158+
href="https://pyarmor.readthedocs.io/en/latest/tutorial/advanced.html#support-multiple-python-versions"
159+
label="Please use same Python major.minor version to obfuscate the scripts\nIf need support multiple Python version\nPlease check this link"]
160+
n3 [href="https://pyarmor.readthedocs.io/en/latest/reference/errors.html"
161+
label="Please check error message table to find solution"]
162+
n4 [style=rounded
163+
label="Try to add print statement in scripts\nFind the problem lines"]
164+
n5 [href="#graph-fix-runtime-crash-issue"
165+
label="Please check how to fix crashing issue"]
166+
n6 [
167+
href="https://pyarmor.readthedocs.io/en/latest/topic/rftmode.html"
168+
label="Please check topic `insight into RFT mode`"]
169+
n7 [
170+
href="https://pyarmor.readthedocs.io/en/latest/topic/bccmode.html"
171+
label="Please check topic `insight into BCC mode`"]
172+
n8 [href="https://pyarmor.readthedocs.io/en/latest/reference/man.html#pyarmor-gen"
173+
label="Understand the usage of each option\nUse the right options\nOr refine the scripts"]
174+
n9 [href="https://pyarmor.readthedocs.io/en/latest/how-to/third-party.html"
175+
label="Check third-party library solutions"]
176+
n10 [href="https://github.com/dashingsoft/pyarmor/issues"
177+
label="Report issue in Github\nThe minimum options to reproduce this issue\nThe simplest script without third-party package"]
178+
}
179+
180+
s3 -> n3 [label="Yes"]
181+
s3 -> n4 [label="No"]
182+
s3 -> n5 [label="Crashed"]
183+
n3 -> s4 [label="No solution found"]
184+
s8 -> n10 [label="Still wrong"]
185+
186+
n4 -> s4
187+
n5 -> s4
188+
189+
edge [tailport=se]
190+
s1 -> n1 [label="No"]
191+
s2 -> n2 [label="No"]
192+
s4 -> n6 [label="Yes"]
193+
s5 -> n7 [label="Yes"]
194+
s6 -> n8 [label="Yes"]
195+
s7 -> n9 [label="Yes"]
196+
}
197+
198+
.. graphviz::
199+
:caption: Fix crash issues in runtime
200+
:align: center
201+
:name: graph-fix-runtime-crash-issue
202+
203+
digraph G {
204+
node [shape=box, style=rounded]
205+
206+
start [shape="doublecircle", label="",
207+
style="filled", fillcolor="wheat"]
208+
209+
subgraph P0 {
210+
rankdir="TB"
211+
style="setlinewidth(0)"
212+
213+
s1 [label="Is target device Apple M1+ ?"]
214+
s2 [label="Which Python interpreter to run the obfuscated scripts?"]
215+
}
216+
217+
subgraph P1 {
218+
node [
219+
style="filled,rounded",
220+
fillcolor="burlywood",
221+
]
222+
n1 [label="Check extension pyarmor_runtime.so by codesign"]
223+
n2 [href="https://pyarmor.readthedocs.io/en/latest/topic/obfuscated-script.html"
224+
label="Check doc to understand obfuscated scripts"]
225+
n3 [href="https://github.com/dashingsoft/pyarmor/issues"
226+
label="Report issue in Github\nThe minimum options to reproduce this issue\nThe simplest script without third-party package"]
227+
}
228+
229+
start -> s1
230+
s1 -> s2 -> n3
231+
232+
edge [tailport=se]
233+
s1 -> n1 [label="Yes"]
234+
s2 -> n2 [label="Not CPython"]
235+
}
236+
43237
.. _run-packed-script-issue:
44238

45239
How to fix issues when executing packed bundle
46240
----------------------------------------------
241+
242+
.. graphviz::
243+
:caption: Fix issues when executing packed bundle
244+
:align: center
245+
:name: graph-run-packed-script-issue
246+
247+
digraph G {
248+
node [shape=box, style=rounded]
249+
250+
start [shape="doublecircle", label="",
251+
style="filled", fillcolor="wheat"]
252+
253+
subgraph P0 {
254+
rankdir="TB"
255+
style="setlinewidth(0)"
256+
257+
s2 [label="In build device, do not obfuscate scripts\npack the plain scripts by Pyinstaller directly\nThen run the final bundle in target device\nDoes it work?"]
258+
s3 [label="In build device, do not use option --pack\nOnly obfuscate scripts\nThen run the obfuscated scripts in target device\nDoes it work?"]
259+
s4 [label="In build device, try fewer options\nUse the minimu options to pack scripts\nThen run the final bundle in target device\nDoes it work?"]
260+
s5 [
261+
style="filled,rounded",
262+
fillcolor="burlywood",
263+
href="https://pyarmor.readthedocs.io/en/latest/topic/repack.html"
264+
label="Refer to doc about packing topic\nPack the scripts by fewer options"]
265+
s6 [label="Try to pack one hello-world script\nThen run it in target device\nDoes is work?"]
266+
267+
s2 -> s3 -> s4 -> s5
268+
s4 -> s6 [label="Error", tailport=se]
269+
}
270+
271+
subgraph P2 {
272+
node [
273+
style="filled,rounded",
274+
fillcolor="burlywood",
275+
]
276+
n1 [
277+
href="https://pyinstaller.org/en/stable/usage.html"
278+
label="Please refer to PyInstaller doc\nMake sure PyInstaller could pack the plain scripts\nAnd the final bundle works in target device"]
279+
n2 [
280+
href="#run-obfuscated-script-issue"
281+
label="Please check how to fix running obfuscated script issues"]
282+
n3 [
283+
href="https://pyarmor.readthedocs.io/en/latest/how-to/third-party.html"
284+
label="Please check third-party library compatibility"]
285+
n4 [
286+
href="https://github.com/dashingsoft/pyarmor/issues"
287+
label="Report issue in Github\nThe minimum options to reproduce this issue\nThe simplest script without third-party package"]
288+
}
289+
290+
start -> s2
291+
s6 -> n3
292+
293+
edge [tailport=se]
294+
295+
s2 -> n1 [label="Error"]
296+
s3 -> n2 [label="Error"]
297+
s6 -> n4 [label="Error" tailport=e]
298+
}

0 commit comments

Comments
 (0)