pyarmor.cli 9.2.0__tar.gz → 9.2.1__tar.gz
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.
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/PKG-INFO +1 -1
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/__init__.py +1 -1
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/__main__.py +1 -1
- pyarmor_cli-9.2.1/pyarmor/cli/batch.py +62 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/command.py +42 -11
- pyarmor_cli-9.2.1/pyarmor/cli/core.data.1 +0 -0
- pyarmor_cli-9.2.1/pyarmor/cli/core.data.2 +0 -0
- pyarmor_cli-9.2.1/pyarmor/cli/core.data.3 +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/default.cfg +5 -5
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/register.py +5 -3
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/resource.py +21 -9
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor.cli.egg-info/PKG-INFO +1 -1
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor.cli.egg-info/SOURCES.txt +1 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/setup.py +1 -1
- pyarmor_cli-9.2.0/pyarmor/cli/core.data.1 +0 -0
- pyarmor_cli-9.2.0/pyarmor/cli/core.data.2 +0 -0
- pyarmor_cli-9.2.0/pyarmor/cli/core.data.3 +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/README.rst +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/bootstrap.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/bug.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/config.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/context.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/docker.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/generate.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/hdinfo.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/merge.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/mixer.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/model.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/plugin.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/project.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/public_capsule.zip +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/repack.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor/cli/shell.py +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor.cli.egg-info/dependency_links.txt +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor.cli.egg-info/entry_points.txt +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor.cli.egg-info/requires.txt +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/pyarmor.cli.egg-info/top_level.txt +0 -0
- {pyarmor_cli-9.2.0 → pyarmor_cli-9.2.1}/setup.cfg +0 -0
|
@@ -325,7 +325,7 @@ def cmd_reg(ctx, args):
|
|
|
325
325
|
|
|
326
326
|
else:
|
|
327
327
|
regsvr = WebRegister(ctx)
|
|
328
|
-
regsvr.check_request_interval()
|
|
328
|
+
regsvr.check_request_interval(activation=regfile)
|
|
329
329
|
info, msg = regsvr.prepare(regfile, args.product, upgrade=upgrade)
|
|
330
330
|
prompt = 'Are you sure to continue? (yes/no) '
|
|
331
331
|
if args.confirm:
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
#
|
|
4
|
+
#############################################################
|
|
5
|
+
# #
|
|
6
|
+
# Copyright @ 2025 - Dashingsoft corp. #
|
|
7
|
+
# All rights reserved. #
|
|
8
|
+
# #
|
|
9
|
+
# Pyarmor #
|
|
10
|
+
# #
|
|
11
|
+
# Version: 9.2.1 - #
|
|
12
|
+
# #
|
|
13
|
+
#############################################################
|
|
14
|
+
#
|
|
15
|
+
#
|
|
16
|
+
# @File: cli/shell.py
|
|
17
|
+
#
|
|
18
|
+
# @Author: Jondy Zhao (pyarmor@163.com)
|
|
19
|
+
#
|
|
20
|
+
# @Create Date: Wed Nov 5 20:22:52 CST 2025
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
"""This script could run batch pyarmor commands.
|
|
24
|
+
|
|
25
|
+
For example:
|
|
26
|
+
|
|
27
|
+
python3 -m pyarmor.cli.batch build-script.sh
|
|
28
|
+
|
|
29
|
+
cd abc
|
|
30
|
+
pyarmor
|
|
31
|
+
|
|
32
|
+
The main purpose is to fix pyarmor CI License send too many request issues.
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
import shlex
|
|
36
|
+
import os
|
|
37
|
+
|
|
38
|
+
from pyarmor.cli.__main__ import main_entry as pyarmor_run
|
|
39
|
+
|
|
40
|
+
# Do not run `pyarmor reg pyarmor-ci-xxxx.zip` here, run it before this script
|
|
41
|
+
|
|
42
|
+
build_commands = """
|
|
43
|
+
pyarmor gen main.py
|
|
44
|
+
cd ../package1
|
|
45
|
+
pyarmor gen -R --enable-bcc src/
|
|
46
|
+
cd ../package2
|
|
47
|
+
pyarmor gen -R --enable-jit --private src/
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
for cmd in build_commands.splitlines():
|
|
51
|
+
if cmd.startswith('#'):
|
|
52
|
+
continue
|
|
53
|
+
|
|
54
|
+
if cmd.startswith('cd '):
|
|
55
|
+
path = cmd[3:].strip()
|
|
56
|
+
print('Change current path:', path)
|
|
57
|
+
os.chdir(path)
|
|
58
|
+
|
|
59
|
+
elif cmd.startswith('pyarmor '):
|
|
60
|
+
print('Execute: ', cmd)
|
|
61
|
+
args = shlex.split(cmd[8:].strip())
|
|
62
|
+
pyarmor_run(args)
|
|
@@ -135,16 +135,6 @@ class Commander:
|
|
|
135
135
|
# action="store_const", const='std',
|
|
136
136
|
# help='genetate standard obfuscated scripts'
|
|
137
137
|
# )
|
|
138
|
-
# group.add_argument(
|
|
139
|
-
# '--ecc', dest='target', default='std',
|
|
140
|
-
# action="store_const", const='ecc',
|
|
141
|
-
# help='genetate scripts with embedded C code'
|
|
142
|
-
# )
|
|
143
|
-
# group.add_argument(
|
|
144
|
-
# '--vmc', dest='target', default='std',
|
|
145
|
-
# action="store_const", const='vmc',
|
|
146
|
-
# help='genetate scripts with vm C code'
|
|
147
|
-
# )
|
|
148
138
|
group.add_argument(
|
|
149
139
|
'--rft', dest='target', default='std',
|
|
150
140
|
action="store_const", const='rft',
|
|
@@ -158,7 +148,27 @@ class Commander:
|
|
|
158
148
|
group.add_argument(
|
|
159
149
|
'--mini-rft', dest='target', default='std',
|
|
160
150
|
action="store_const", const='mini-rft',
|
|
161
|
-
help='
|
|
151
|
+
help='generate scripts by combining --rft and --mini'
|
|
152
|
+
)
|
|
153
|
+
group.add_argument(
|
|
154
|
+
'--vmc', dest='target', default='std',
|
|
155
|
+
action="store_const", const='vmc',
|
|
156
|
+
help='genetate scripts with vmc code'
|
|
157
|
+
)
|
|
158
|
+
group.add_argument(
|
|
159
|
+
'--vmc-rft', dest='target', default='std',
|
|
160
|
+
action="store_const", const='vmc-rft',
|
|
161
|
+
help='generate scripts by combining --rft and --vmc'
|
|
162
|
+
)
|
|
163
|
+
group.add_argument(
|
|
164
|
+
'--ecc', dest='target', default='std',
|
|
165
|
+
action="store_const", const='ecc',
|
|
166
|
+
help='genetate scripts with embedded C code'
|
|
167
|
+
)
|
|
168
|
+
group.add_argument(
|
|
169
|
+
'--ecc-rft', dest='target', default='std',
|
|
170
|
+
action="store_const", const='ecc',
|
|
171
|
+
help='generate scripts by combining --rft and --ecc'
|
|
162
172
|
)
|
|
163
173
|
group.add_argument(
|
|
164
174
|
'--list', dest='target', default='std',
|
|
@@ -412,6 +422,8 @@ class Commander:
|
|
|
412
422
|
logger.info('build target %s ...', args.target)
|
|
413
423
|
output = args.output if args.output else 'dist'
|
|
414
424
|
self._build(project, args.target, output)
|
|
425
|
+
if args.target.startswith('std'):
|
|
426
|
+
self._cmd_gen(args)
|
|
415
427
|
logger.info('build target %s end', args.target)
|
|
416
428
|
|
|
417
429
|
def _build(self, project, target, output, value=None):
|
|
@@ -420,6 +432,25 @@ class Commander:
|
|
|
420
432
|
m = Pytransform3.init(self.ctx)
|
|
421
433
|
m.pre_build(args)
|
|
422
434
|
|
|
435
|
+
def _cmd_gen(self, args):
|
|
436
|
+
"""If build target is std, then call `pyarmor gen`
|
|
437
|
+
|
|
438
|
+
It will obfuscate the scripts with `pyarmor_runtime.so`
|
|
439
|
+
|
|
440
|
+
Most of obfuscated options are got from config file, not from
|
|
441
|
+
command line
|
|
442
|
+
|
|
443
|
+
Option `--pack` may be still got from command line
|
|
444
|
+
"""
|
|
445
|
+
from .generate import Builder
|
|
446
|
+
from .plugin import Plugin
|
|
447
|
+
|
|
448
|
+
ctx = self.ctx
|
|
449
|
+
builder = Builder(ctx)
|
|
450
|
+
Plugin.install(ctx)
|
|
451
|
+
builder.process(args)
|
|
452
|
+
Plugin.post_build(ctx)
|
|
453
|
+
|
|
423
454
|
def cmd_env(self, ctx, args):
|
|
424
455
|
"""Check and change pyarmor settings
|
|
425
456
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
;; Pyarmor version
|
|
4
4
|
major = 9
|
|
5
5
|
minor = 2
|
|
6
|
-
patch =
|
|
6
|
+
patch = 1
|
|
7
7
|
|
|
8
|
-
;; Compatible core version
|
|
8
|
+
;; Compatible core version for package: pyarmor.cli.core
|
|
9
9
|
cli.core = 8.1.0
|
|
10
|
-
mini.core = 2.0
|
|
11
10
|
|
|
12
|
-
;;
|
|
13
|
-
;;
|
|
11
|
+
;; Compatible core version for package: pyarmor.mini
|
|
12
|
+
;; Which is required to run MINI, VMC, or ECC mode scripts
|
|
13
|
+
mini.core = 3.0
|
|
14
14
|
|
|
15
15
|
;; Deprecated since Pyarmor 8.2.5
|
|
16
16
|
; cli.runtime = 3.2.5
|
|
@@ -498,7 +498,7 @@ class WebRegister(Register):
|
|
|
498
498
|
conn.request("GET", url[k:])
|
|
499
499
|
return conn.getresponse()
|
|
500
500
|
|
|
501
|
-
def check_request_interval(self, delta=30.0):
|
|
501
|
+
def check_request_interval(self, delta=30.0, activation=False):
|
|
502
502
|
"""Make sure no more than 2 requests in 1 minute"""
|
|
503
503
|
tspath = os.path.join(self.ctx.reg_path, 'last_register')
|
|
504
504
|
try:
|
|
@@ -509,8 +509,10 @@ class WebRegister(Register):
|
|
|
509
509
|
from time import sleep, time
|
|
510
510
|
d = delta - (time() - st.st_mtime)
|
|
511
511
|
if d > 0:
|
|
512
|
-
|
|
513
|
-
|
|
512
|
+
if activation:
|
|
513
|
+
logger.warning(
|
|
514
|
+
'caution: this activation file "%s" can only '
|
|
515
|
+
'be used no more than 10 times', activation)
|
|
514
516
|
logger.info('waiting for %d seconds', d)
|
|
515
517
|
while time() - st.st_mtime < delta:
|
|
516
518
|
logger.info('waiting ...')
|
|
@@ -109,22 +109,34 @@ class FileResource(Resource):
|
|
|
109
109
|
return self.pyext.lower() == '.pyc'
|
|
110
110
|
|
|
111
111
|
def _get_encoding(self, encoding):
|
|
112
|
+
# Maybe: from tokenize import detect_encoding
|
|
112
113
|
from codecs import BOM_UTF8
|
|
113
114
|
from re import search as research
|
|
115
|
+
|
|
116
|
+
def find_encoding(line):
|
|
117
|
+
try:
|
|
118
|
+
pat = r'coding[=:]\s*([-\w.]+)'
|
|
119
|
+
n = line.find(b'\n')
|
|
120
|
+
if n > -1:
|
|
121
|
+
m = research(pat, line[:n].decode())
|
|
122
|
+
if m:
|
|
123
|
+
return m.group(1)
|
|
124
|
+
if line[n+1] == 35:
|
|
125
|
+
k = n + 1
|
|
126
|
+
n = line.find(b'\n', k)
|
|
127
|
+
m = research(pat, line[k:n].decode())
|
|
128
|
+
if m:
|
|
129
|
+
return m.group(1)
|
|
130
|
+
except Exception:
|
|
131
|
+
# Ignore decoding error or index error
|
|
132
|
+
pass
|
|
133
|
+
|
|
114
134
|
with open(self.fullpath, 'rb') as f:
|
|
115
135
|
line = f.read(80)
|
|
116
136
|
if line and line[:3] == BOM_UTF8:
|
|
117
137
|
return 'utf-8'
|
|
118
138
|
if line and line[0] == 35:
|
|
119
|
-
|
|
120
|
-
m = research(r'coding[=:]\s*([-\w.]+)', line[:n].decode())
|
|
121
|
-
if m:
|
|
122
|
-
return m.group(1)
|
|
123
|
-
if n > -1 and len(line) > (n+1) and line[n+1] == 35:
|
|
124
|
-
k = n + 1
|
|
125
|
-
n = line.find(b'\n', k)
|
|
126
|
-
m = research(r'coding[=:]\s*([-\w.]+)', line[k:n].decode())
|
|
127
|
-
return m and m.group(1)
|
|
139
|
+
encoding = find_encoding(line) or encoding
|
|
128
140
|
return encoding
|
|
129
141
|
|
|
130
142
|
def readlines(self, encoding=None):
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|