|
1 | 1 | ==========
|
2 |
| - 命令手册 |
| 2 | + 功能手册 |
3 | 3 | ==========
|
4 | 4 |
|
5 | 5 | .. highlight:: console
|
6 | 6 |
|
| 7 | +.. contents:: 目录 |
| 8 | + :depth: 2 |
| 9 | + :local: |
| 10 | + :backlinks: top |
| 11 | + |
7 | 12 | .. _cmd-init:
|
8 | 13 |
|
9 | 14 | pyarmor init
|
10 | 15 | ============
|
11 | 16 |
|
| 17 | +.. _create-project: |
| 18 | + |
| 19 | +创建工程 |
| 20 | +-------- |
| 21 | + |
| 22 | +.. graphviz:: |
| 23 | + :caption: 创建工程 |
| 24 | + :align: center |
| 25 | + :name: g-create-project |
| 26 | + |
| 27 | + digraph G { |
| 28 | + node [shape=box, style=rounded, target="_top"] |
| 29 | + rankdir=LR |
| 30 | + |
| 31 | + opts [shape=record |
| 32 | + label="{-C|-s|-r|-x}"] |
| 33 | + init [label="pyarmor init"] |
| 34 | + conf [label="配置文件 .pyarmor/config"] |
| 35 | + |
| 36 | + init -> opts [label="使用选项" dir=back] |
| 37 | + rank=same { init -> conf [label="写入"] } |
| 38 | + } |
| 39 | + |
| 40 | +.. _append-project-item: |
| 41 | + |
| 42 | +增加脚本/模块/包到工程 |
| 43 | +---------------------- |
| 44 | + |
| 45 | +.. graphviz:: |
| 46 | + :caption: 增加脚本/模块/包到工程 |
| 47 | + :align: center |
| 48 | + :name: g-append-project-item |
| 49 | + |
| 50 | + digraph G { |
| 51 | + node [shape=box, style=rounded, target="_top"] |
| 52 | + rankdir=LR |
| 53 | + |
| 54 | + opts [shape=record |
| 55 | + label="{-e|-m|-p}"] |
| 56 | + init [label="pyarmor init"] |
| 57 | + conf [label="配置文件 .pyarmor/config"] |
| 58 | + |
| 59 | + init -> opts [label="使用选项" dir=back] |
| 60 | + rank=same { init -> conf [label="写入"] } |
| 61 | + } |
| 62 | + |
12 | 63 | .. _cmd-env:
|
13 | 64 |
|
14 | 65 | pyarmor env
|
15 | 66 | ===========
|
16 | 67 |
|
| 68 | +.. _show-project-info: |
| 69 | + |
| 70 | +显示工程配置 |
| 71 | +------------ |
| 72 | + |
| 73 | +.. graphviz:: |
| 74 | + :caption: 显示工程配置 |
| 75 | + :align: center |
| 76 | + :name: g-show-project-info |
| 77 | + |
| 78 | + digraph G { |
| 79 | + node [shape=box, style=rounded, target="_top"] |
| 80 | + |
| 81 | + init [label="pyarmor env -p info"] |
| 82 | + conf [label="配置文件 .pyarmor/config"] |
| 83 | + info [label="工程信息"] |
| 84 | + |
| 85 | + rank=same { conf -> init [label="读取"] } |
| 86 | + init -> info [label="显示"] |
| 87 | + } |
| 88 | + |
| 89 | +.. _edit-project-info: |
| 90 | + |
| 91 | +修改工程配置 |
| 92 | +------------ |
| 93 | + |
| 94 | +.. graphviz:: |
| 95 | + :caption: 修改工程配置 |
| 96 | + :align: center |
| 97 | + :name: g-edit-project-info |
| 98 | + |
| 99 | + digraph G { |
| 100 | + node [shape=box, style=rounded, target="_top"] |
| 101 | + rankdir=LR |
| 102 | + |
| 103 | + opts [label="工程选项" |
| 104 | + href="../../docs/zh/configuration.html"] |
| 105 | + env [label="pyarmor env -p set opt value"] |
| 106 | + conf [label="配置文件 .pyarmor/config"] |
| 107 | + |
| 108 | + env -> opts [dir=none] |
| 109 | + rank=same { env -> conf [label="写入"] } |
| 110 | + } |
| 111 | + |
17 | 112 | .. _cmd-build:
|
18 | 113 |
|
19 | 114 | pyarmor build
|
20 | 115 | =============
|
21 | 116 |
|
22 |
| -.. _config-file: |
| 117 | +.. _list-project-items: |
| 118 | + |
| 119 | +列出工程中包含的脚本/模块/包 |
| 120 | +---------------------------- |
| 121 | + |
| 122 | +.. graphviz:: |
| 123 | + :caption: 列出工程中包含的脚本/模块/包 |
| 124 | + :align: center |
| 125 | + :name: g-list-project-items |
| 126 | + |
| 127 | + digraph G { |
| 128 | + node [shape=box, style=rounded, target="_top"] |
| 129 | + |
| 130 | + conf [label="配置文件 .pyarmor/config" |
| 131 | + href="../../docs/zh/configuration.html"] |
| 132 | + build [label="pyarmor build --list"] |
| 133 | + items [label="显示工程中包含的所有脚本名称"] |
| 134 | + |
| 135 | + conf -> build [label="读取" dir=none] |
| 136 | + build -> items [label="根据项目选项配置进行搜索和过滤"] |
| 137 | + } |
| 138 | + |
| 139 | +.. _project-build-rft: |
| 140 | + |
| 141 | +生成重构型脚本 |
| 142 | +-------------- |
| 143 | + |
| 144 | +.. graphviz:: |
| 145 | + :caption: 生成重构型脚本 |
| 146 | + :align: center |
| 147 | + :name: g-project-build-rft |
| 148 | + |
| 149 | + digraph G { |
| 150 | + node [shape=box, style=rounded, target="_top"] |
| 151 | + |
| 152 | + build [label="pyarmor build --rft" |
| 153 | + style="filled,rounded" |
| 154 | + fillcolor="wheat"] |
| 155 | + join1 [shape=point] |
| 156 | + |
| 157 | + items [label="依次处理每一个脚本"] |
| 158 | + |
| 159 | + conf [label="工程属性\n存放在 .pyarmor/config 中"] |
| 160 | + |
| 161 | + rules [shape=plaintext |
| 162 | + label="工程的重构选项\n存放在 .pyarmor/config 中"] |
| 163 | + autofix [shape=plain |
| 164 | + label="自动生成的重构规则\n存放在 .pyarmor/project/rft_autofix.rules"] |
| 165 | + |
| 166 | + p1 [label="应用重构规则"] |
| 167 | + rft [label="生成重构脚本"] |
| 168 | + |
| 169 | + build -> join1 |
| 170 | + join1 -> conf [dir=none] |
| 171 | + join1 -> items [label="得到工程中的脚本列表"] |
| 172 | + items -> p1 |
| 173 | + rank=same { p1 -> rft } |
| 174 | + |
| 175 | + p1 -> rules [arrowtail=curve dir=back] |
| 176 | + p1 -> autofix [arrowtail=curve dir=back] |
| 177 | + } |
| 178 | + |
| 179 | +.. _project-rft-autofix: |
| 180 | + |
| 181 | +生成重构脚本自动修正规则 |
| 182 | +------------------------ |
| 183 | + |
| 184 | +Pyarmor 目前实现三种自动修改模式,模式序号越大,重命名的名称越多 |
| 185 | + |
| 186 | +例如,模式一中可能有 10 个属性没有进行重命名,模式二中可能只有 3 个属性没有重命名 |
| 187 | + |
| 188 | +**下面的命令只是生成重构规则,并不生成重构脚本** |
| 189 | + |
| 190 | +.. graphviz:: |
| 191 | + :caption: 使用模式一生成重构脚本自动修正规则 |
| 192 | + :align: center |
| 193 | + :name: g-project-rft-autofix-1 |
| 194 | + |
| 195 | + digraph G { |
| 196 | + node [shape=box, style=rounded, target="_top"] |
| 197 | + |
| 198 | + build [label="pyarmor build --autofix 1" |
| 199 | + style="filled,rounded" |
| 200 | + fillcolor="wheat"] |
| 201 | + join1 [shape=point] |
| 202 | + |
| 203 | + items [label="依次处理每一个脚本"] |
| 204 | + |
| 205 | + conf [label="工程属性\n存放在 .pyarmor/config 中"] |
| 206 | + |
| 207 | + rules [shape=plaintext |
| 208 | + label="工程的重构选项\n存放在 .pyarmor/config 中"] |
| 209 | + autofix [shape=component |
| 210 | + style="filled" |
| 211 | + fillcolor="wheat" |
| 212 | + label="生成重构规则\n所有未知属性都不进行重命名\n保存规则到 .pyarmor/project/rft_autofix.rules"] |
| 213 | + |
| 214 | + p1 [label="应用重构规则"] |
| 215 | + rft [label="尝试重构脚本\n如果某一个属性无法确定是否需要重命名\n那么记录到未知属性表中"] |
| 216 | + |
| 217 | + loop [label="合并所有脚本生成的未知属性表"] |
| 218 | + |
| 219 | + build -> join1 |
| 220 | + join1 -> conf [dir=none] |
| 221 | + join1 -> items [label="得到工程中的脚本列表"] |
| 222 | + items -> p1 |
| 223 | + rank=same { p1 -> rft } |
| 224 | + p1 -> rules [arrowtail=curve dir=back] |
| 225 | + |
| 226 | + rft -> loop -> autofix |
| 227 | + } |
| 228 | + |
| 229 | +.. graphviz:: |
| 230 | + :caption: 使用模式二生成重构脚本自动修正规则 |
| 231 | + :align: center |
| 232 | + :name: g-project-rft-autofix-2 |
| 233 | + |
| 234 | + digraph G { |
| 235 | + node [shape=box, style=rounded, target="_top"] |
| 236 | + |
| 237 | + build [label="pyarmor build --autofix 2" |
| 238 | + style="filled,rounded" |
| 239 | + fillcolor="wheat"] |
| 240 | + join1 [shape=point] |
| 241 | + |
| 242 | + items [label="依次处理每一个脚本"] |
| 243 | + |
| 244 | + conf [label="工程属性\n存放在 .pyarmor/config 中"] |
| 245 | + |
| 246 | + rules [shape=plaintext |
| 247 | + label="工程的重构选项\n存放在 .pyarmor/config 中"] |
| 248 | + p1 [label="应用重构规则"] |
| 249 | + rft [label="尝试重构脚本\n记录不知道如何处理的属性\n生成未知属性表"] |
| 250 | + |
| 251 | + u1 [label="读取所有内置类型\n例如 int, list 等的属性"] |
| 252 | + u2 [label="读取重构选项 external_types\n得到所有外部导入类型的属性"] |
| 253 | + un [label="合并内置和外部类型的属性\n生成外部属性表"] |
| 254 | + u1 -> un |
| 255 | + u2 -> un |
| 256 | + |
| 257 | + autofix [shape=component |
| 258 | + style="filled" |
| 259 | + fillcolor="wheat" |
| 260 | + label="生成重构规则\n未知属性和外部属性的交集都不进行重命名\n其他未知属性都进行重命名\n保存规则到 .pyarmor/project/rft_autofix.rules"] |
| 261 | + un -> autofix |
| 262 | + |
| 263 | + build -> join1 |
| 264 | + join1 -> conf [dir=none] |
| 265 | + join1 -> items [label="得到工程中的脚本列表"] |
| 266 | + items -> p1 |
| 267 | + rank=same { p1 -> rft } |
| 268 | + p1 -> rules [arrowtail=curve dir=back] |
| 269 | + rules -> u2 [arrowhead=curve] |
| 270 | + rft -> autofix |
| 271 | + |
| 272 | + rank=same { rft -> un [style=invis] } |
| 273 | + } |
| 274 | + |
| 275 | +.. graphviz:: |
| 276 | + :caption: 使用模式三生成重构脚本自动修正规则 |
| 277 | + :align: center |
| 278 | + :name: g-project-rft-autofix-3 |
| 279 | + |
| 280 | + digraph G { |
| 281 | + node [shape=box, style=rounded, target="_top"] |
| 282 | + |
| 283 | + build [label="pyarmor build --autofix 3" |
| 284 | + style="filled,rounded" |
| 285 | + fillcolor="wheat"] |
| 286 | + join1 [shape=point] |
| 287 | + |
| 288 | + items [label="依次处理每一个脚本"] |
| 289 | + |
| 290 | + conf [label="工程属性\n存放在 .pyarmor/config 中"] |
| 291 | + |
| 292 | + rules [shape=plaintext |
| 293 | + label="工程的重构选项\n存放在 .pyarmor/config 中"] |
| 294 | + p1 [label="应用重构规则"] |
| 295 | + rft [label="尝试重构每一个脚本"] |
| 296 | + |
| 297 | + n1 [label="记录工程内部模块定义的类型\n合并所有内部类型的属性\n生成内部属性表"] |
| 298 | + n2 [label="记录所有的未知属性\n生成未知属性表"] |
| 299 | + |
| 300 | + autofix [shape=component |
| 301 | + style="filled" |
| 302 | + fillcolor="wheat" |
| 303 | + label="生成重构规则\n所有内部属性名称都会进行重命名\n保存规则到 .pyarmor/project/rft_autofix.rules"] |
| 304 | + autolog [shape=component |
| 305 | + style="filled" |
| 306 | + fillcolor="wheat" |
| 307 | + label="生成未知属性所在文件和行号\n保存到 .pyarmor/project/rft_autofix.log\n用户需要根据日志人工生成重构规则"] |
| 308 | + |
| 309 | + build -> join1 |
| 310 | + join1 -> conf [dir=none] |
| 311 | + join1 -> items [label="得到工程中的脚本列表"] |
| 312 | + items -> p1 |
| 313 | + rank=same { p1 -> rft } |
| 314 | + p1 -> rules [arrowtail=curve dir=back] |
| 315 | + rft -> n1 -> autofix |
| 316 | + rank=same { rft -> n2 } |
| 317 | + n2 -> autolog |
| 318 | + } |
| 319 | + |
| 320 | +.. _project-build-mini: |
| 321 | + |
| 322 | +生成迷你型脚本 |
| 323 | +-------------- |
| 324 | + |
| 325 | +.. graphviz:: |
| 326 | + :caption: 生成迷你型脚本 |
| 327 | + :align: center |
| 328 | + :name: g-project-build-mini |
| 329 | + |
| 330 | + digraph G { |
| 331 | + node [shape=box, style=rounded, target="_top"] |
| 332 | + |
| 333 | + build [label="pyarmor build --mini" |
| 334 | + style="filled,rounded" |
| 335 | + fillcolor="wheat"] |
| 336 | + join1 [shape=point] |
| 337 | + |
| 338 | + items [label="依次处理每一个脚本"] |
| 339 | + conf [label="工程属性\n存放在 .pyarmor/config 中"] |
| 340 | + mini [label="生成迷你型加密脚本"] |
23 | 341 |
|
24 |
| -配置文件 |
25 |
| -======== |
| 342 | + build -> join1 |
| 343 | + join1 -> conf [dir=none] |
| 344 | + join1 -> items [label="得到工程中的脚本列表"] |
| 345 | + items -> mini |
| 346 | + } |
0 commit comments