Skip to content

Commit 469a393

Browse files
committed
Add new learn pages
1 parent fb8609e commit 469a393

File tree

6 files changed

+145
-27
lines changed

6 files changed

+145
-27
lines changed

pyarmor/learn/zh/commands.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
==========
2+
命令手册
3+
==========
4+
5+
.. highlight:: console
6+
7+
.. _cmd-init:
8+
9+
pyarmor init
10+
============
11+
12+
.. _cmd-env:
13+
14+
pyarmor env
15+
===========
16+
17+
.. _cmd-build:
18+
19+
pyarmor build
20+
=============

pyarmor/learn/zh/concepts.rst

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ Pyarmor 命令行工具是提供了命令行操作方式的一个应用程序
1717
:name: graph-pyarmor-cli-lifecycle
1818

1919
digraph G {
20-
node [shape=box, style=rounded]
20+
node [shape=box, style=rounded, target="_top"]
2121

22-
package [label="Python 包 pyarmor.cli\n发布在 PyPI"]
22+
package [label="Python 包 pyarmor.cli\n发布在 PyPI"
23+
href="https://pypi.org/project/pyarmor.cli/"]
2324
install [label="在构建设备上面安装 pyarmor 命令\npip install pyarmor.cli"]
2425
pyarmor [label="执行命令 pyarmor\n实现 Pyarmor 的功能"]
2526

@@ -34,16 +35,16 @@ Pyarmor 命令行工具是提供了命令行操作方式的一个应用程序
3435
:name: g-pyarmor-cli-components
3536

3637
digraph G {
37-
node [shape=box, style=rounded]
38+
node [shape=box, style=rounded, target="_top"]
3839

3940
subgraph C {
4041
cluster=true
4142
label="子命令"
4243
style="setlinewidth(0)"
4344

44-
init [label="pyarmor init"]
45-
env [label="pyarmor env"]
46-
build [label="pyarmor build"]
45+
init [label="pyarmor init", href="commands.html#cmd-init"]
46+
env [label="pyarmor env", href="commands.html#cmd-env"]
47+
build [label="pyarmor build", href="commands.html#cmd-build"]
4748
}
4849
}
4950

@@ -56,16 +57,16 @@ Pyarmor 命令行工具是提供了命令行操作方式的一个应用程序
5657
:name: g-pyarmor-cli-functions
5758

5859
digraph G {
59-
node [shape=box, style=rounded]
60+
node [shape=box, style=rounded, target="_top"]
6061

61-
init [label="pyarmor init"]
62-
env [label="pyarmor env"]
63-
build [label="pyarmor build"]
62+
init [label="pyarmor init", href="commands.html#cmd-init"]
63+
env [label="pyarmor env", href="commands.html#cmd-env"]
64+
build [label="pyarmor build", href="commands.html#cmd-build"]
6465

65-
project [label="工程"]
66-
miniscript [label="迷你型加密脚本"]
67-
rftscript [label="重构型加密脚本"]
68-
license [shape=component, label="Pyarmor 许可证", target="_top", href="https://pyarmor.readthedocs.io/zh/latest/licenses.html"]
66+
project [label="工程", href="concepts.html#project"]
67+
miniscript [label="迷你型加密脚本", href="concepts.html#mini-script"]]
68+
rftscript [label="重构型加密脚本", href="concepts.html#rft-script"]]
69+
license [shape=component, label="Pyarmor 许可证", href="https://pyarmor.readthedocs.io/zh/latest/licenses.html"]
6970
joint [shape=point]
7071

7172
init -> project [label="创建"]
@@ -91,18 +92,18 @@ Pyarmor 工程
9192
:name: g-project-components
9293

9394
digraph G {
94-
node [shape=box, style=rounded]
95+
node [shape=box, style=rounded, target="_top]
9596
rankdir="LR"
9697

9798
subgraph C {
9899
cluster=true
99100
label="工程"
100101

101-
scripts [label="脚本"]
102-
modules [label="模块"]
103-
package [label="包"]
102+
scripts [label="脚本", href="project.html"]
103+
modules [label="模块", href="project.html"]
104+
package [label="包", href="project.html"]
104105

105-
rftoptions [label="重构选项", shape=diamond]
106+
rftoptions [label="重构选项", shape=diamond, href="project.html#rft-options"]
106107
}
107108

108109
edge [style=invis]
@@ -119,17 +120,17 @@ Pyarmor 工程
119120
:name: g-script-types
120121

121122
digraph G {
122-
node [shape=box, style=rounded]
123+
node [shape=box, style=rounded, target="_top]
123124
rankdir="LR"
124125

125126
subgraph C {
126127
cluster=true
127128
label="加密脚本类型"
128129
style="setlinewidth(0)"
129130

130-
std [label="标准型", target="_top", href="https://pyarmor.readthedocs.io/zh/latest/tutorial/getting-started.html"]
131-
rft [label="重构型", target="_top", href="concepts.html#rft-script"]
132-
mini [label="迷你型", target="_top", href="concepts.html#mini-script"]
131+
std [label="标准型", href="https://pyarmor.readthedocs.io/zh/latest/tutorial/getting-started.html"]
132+
rft [label="重构型", href="concepts.html#rft-script"]
133+
mini [label="迷你型", href="concepts.html#mini-script"]
133134
}
134135

135136
edge [style=invis]
@@ -207,13 +208,28 @@ Pyarmor 工程
207208
.. code-block:: python
208209
:linenos:
209210
210-
msg = 'Hello'
211-
print(msg)
211+
def plusinc(m, n=1):
212+
return m + n + 1
213+
a = plusinc
214+
b = a
215+
n = b(1, n=2)
216+
217+
def hello():
218+
return b(3, n=4)
219+
220+
print('result is', n + hello())
212221
213222
使用 Pyarmor 生成重构型加密脚本之后,输出的 `dist/foo.py` 内容如下
214223

215224
.. code-block:: python
216225
:linenos:
217226
218-
pyarmor__1 = 'Hello'
219-
pyarmor__2(pyarmor__1)
227+
def pyarmor__3(pyarmor__1, pyarmor__2=1):
228+
return pyarmor__1 + pyarmor__2 + 1
229+
pyarmor__4 = pyarmor__3
230+
pyarmor__5 = pyarmor__4
231+
pyarmor__2 = pyarmor__5(1, pyarmor__2=2)
232+
233+
def pyarmor__6():
234+
return pyarmor__5(3, pyarmor__2=4)
235+
print('result is', pyarmor__2 + pyarmor__6())

pyarmor/learn/zh/examples.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
======
2+
示例
3+
======
4+
5+
==========
6+
Examples
7+
==========

pyarmor/learn/zh/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,8 @@
4545
:maxdepth: 2
4646

4747
concepts
48+
project
49+
commands
50+
workflows
51+
examples
4852
how-to

pyarmor/learn/zh/project.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
======
2+
工程
3+
======
4+
5+
.. highlight:: console
6+
7+
工程是用来管理脚本和重构选项的对象
8+
9+
.. graphviz::
10+
:caption: 工程生命周期图
11+
:align: center
12+
:name: graph-project-lifecycle
13+
14+
digraph G {
15+
node [shape=box, style=rounded, target="_top"]
16+
17+
project [label="工程", shape=hexagon, style="filled", fillcolor="burlywood"]
18+
19+
init [label="pyarmor init", href="commands.html#cmd-init"]
20+
env [label="pyarmor env", href="commands.html#cmd-env"]
21+
info [label="pyarmor env -p info", href="commands.html#cmd-env"]
22+
list [label="pyarmor build --list", href="commands.html#cmd-build"]
23+
genrft [label="pyarmor build --rft", href="commands.html#cmd-build"]
24+
genmini [label="pyarmor build --mini", href="commands.html#cmd-build"]
25+
26+
c1 [label="工程信息只能存放在当前目录\n工程属性存放在文件 .pyarmor/config\n工程相关文件存放在目录 .pyarmor/project/"
27+
shape=plain]
28+
29+
init -> project [taillabel="创建"]
30+
env -> project [taillabel="修改和配置"]
31+
rank=same { project -> info [label="显示工程信息"] }
32+
rank=same { list -> project [label="显示工程包含的所有脚本", dir=back] }
33+
project -> genrft [label="生成重构型加密脚本"]
34+
project -> genmini [label="生成迷你型加密脚本"]
35+
36+
c1 -> project [label="约束", dir=none]
37+
}
38+
39+
工程属性
40+
========
41+
42+
.. _rft-options:
43+
44+
重构选项
45+
--------
46+
47+
.. graphviz::
48+
:align: center
49+
:name: g-project-rft-options
50+
51+
digraph G {
52+
node [shape=box, style=rounded, target="_top"]
53+
54+
subgraph C {
55+
cluster=true
56+
label="子命令"
57+
style="setlinewidth(0)"
58+
59+
init [label="pyarmor init", href="commands.html#cmd-init"]
60+
env [label="pyarmor env", href="commands.html#cmd-env"]
61+
build [label="pyarmor build", href="commands.html#cmd-build"]
62+
}
63+
}

pyarmor/learn/zh/workflows.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
==============
3+
内部工作原理
4+
==============
5+
6+
====================
7+
Internal Processes
8+
====================

0 commit comments

Comments
 (0)