pyarmor.cli 8.1.dev2__py2.py3-none-any.whl → 8.1.dev4__py2.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.
pyarmor/cli/__main__.py CHANGED
@@ -116,7 +116,7 @@ def check_cross_platform(ctx, platforms):
116
116
  from pyarmor.cli import runtime
117
117
  except ModuleNotFoundError:
118
118
  raise CliError('cross platform need pyarmor.cli.runtime, please '
119
- 'run "pip install pyarmor.cli.runtime==1.0.1a2" first')
119
+ 'run "pip install pyarmor.cli.runtime==2.1.dev1" first')
120
120
 
121
121
  platnames = []
122
122
  for path in runtime.__path__:
@@ -546,10 +546,10 @@ def log_settings(ctx, args):
546
546
  handler.setLevel(logging.DEBUG)
547
547
  root.addHandler(handler)
548
548
 
549
+ tracelog = logging.getLogger('trace')
550
+ tracelog.propagate = False
551
+ tracelog.addHandler(logging.NullHandler())
549
552
  if ctx.cfg.getboolean('builder', 'enable_trace'):
550
- tracelog = logging.getLogger('trace')
551
- tracelog.propagate = False
552
- tracelog.addHandler(logging.NullHandler())
553
553
  handler = logging.FileHandler(ctx.trace_logfile, mode='w')
554
554
  handler.setFormatter(logging.Formatter('%(name)-20s %(message)s'))
555
555
  handler.setLevel(logging.DEBUG if args.debug else logging.INFO)
pyarmor/cli/context.py CHANGED
@@ -127,6 +127,9 @@ class Context(object):
127
127
  self.extra_libs = {}
128
128
  self.obfuscated_modules = set()
129
129
 
130
+ self.rft_auto_excludes = set()
131
+ self.rft_modules = set()
132
+
130
133
  self.runtime_key = None
131
134
 
132
135
  self.cmd_options = {}
@@ -184,6 +187,8 @@ class Context(object):
184
187
  extra_sect = ':'.join([name, sect])
185
188
  if self.cfg.has_section(extra_sect):
186
189
  options.update(self.cfg.items(extra_sect))
190
+ if sect in ('builder', 'finder'):
191
+ options.update(self.cmd_options)
187
192
  cfg = self._named_config(name + '.ruler')
188
193
  if cfg.has_section(sect):
189
194
  options.update(cfg.items(sect))
@@ -333,14 +338,14 @@ class Context(object):
333
338
  def pyexts(self):
334
339
  return self._opts('finder', 'pyexts').split()
335
340
 
336
- @property
337
- def enable_jit(self):
338
- return self._optb('builder', 'enable_jit')
339
-
340
341
  @property
341
342
  def enable_themida(self):
342
343
  return self._optb('builder', 'enable_themida')
343
344
 
345
+ @property
346
+ def enable_jit(self):
347
+ return self._optb('builder', 'enable_jit')
348
+
344
349
  @property
345
350
  def enable_bcc(self):
346
351
  return self._optb('builder', 'enable_bcc')
pyarmor/cli/default.cfg CHANGED
@@ -47,30 +47,68 @@ findall = 0
47
47
  ; hidden_imports =
48
48
 
49
49
  [builder]
50
+ ;;
51
+ ;; Part 1: only global/local settings, not in module level
52
+ ;;
53
+
50
54
  ;; File encoding to read scripts
51
55
  encoding = utf-8
52
56
 
57
+ ;; Trace obfuscation
58
+ enable_trace = 0
59
+
60
+ ;; Use Themida to protect runtime package in windows
61
+ enable_themida = 0
62
+
63
+ ;; Import prefix to import runtime package
64
+ import_prefix = 0
65
+
66
+ ;; Sometimes __file__ is not defined, replace it with __name__ to fix this issue
67
+ bootstrap_file = __file__
68
+
69
+ ;; Exclude co objects by co_name
70
+ exclude_co_names = <lambda> <listcomp> <setcomp> <dictcomp> <generator>
71
+
72
+ ;; Common modules which are no restrict
73
+ exclude_restrict_modules = __init__
74
+
75
+ ;; Outer key name
76
+ outer_keyname = pyarmor.rkey
77
+
78
+ ;; inline_plugin = "# pyarmor: "
79
+ inline_plugin = 1
80
+
81
+ ;; Using shared runtime package
82
+ ; use_runtime = /path/to/runtime
83
+
84
+ ;; How many loops for jit iv
85
+ jit_iv_threshold = 100
86
+
87
+ ;;
88
+ ;; Part 2: global/local/module level options
89
+ ;;
90
+
53
91
  ;; The argument optimize specifies the optimization level of the
54
92
  ;; compiler; the default value of -1 selects the optimization level of
55
93
  ;; the interpreter as given by -O options. Explicit levels are 0 (no
56
94
  ;; optimization; __debug__ is true), 1 (asserts are removed, __debug__
57
95
  ;; is false) or 2 (docstrings are removed too).
58
96
  optimize = 1
59
- no_annotations = true
60
- no_type_comments = true
97
+
98
+ ;; It's not used now
99
+ type_comments = false
100
+
101
+ ;; Write refactor result scripts
102
+ trace_rft = 0
61
103
 
62
104
  enable_jit = 0
63
105
  enable_bcc = 0
64
106
  enable_rft = 0
65
- enable_themida = 0
66
107
 
67
108
  ;; assert: call import
68
109
  assert_call = 0
69
110
  assert_import = 0
70
111
 
71
- ;; inline_plugin = "# pyarmor: "
72
- inline_plugin = 1
73
-
74
112
  ;; mix string constant
75
113
  mix_str = 0
76
114
 
@@ -83,15 +121,6 @@ obf_code = 1
83
121
  wrap_mode = 1
84
122
 
85
123
  restrict_module = 1
86
- exclude_restrict_modules = __init__
87
-
88
- import_prefix = 0
89
-
90
- ;;
91
- ;; Trace obfuscation
92
- ;;
93
- enable_trace = 0
94
- trace_rft = 0
95
124
 
96
125
  ;;
97
126
  ;; Advanced features
@@ -106,21 +135,6 @@ clear_module_co = 1
106
135
  ;; clear frame.f_locals for wrap mode
107
136
  clear_frame_locals = 0
108
137
 
109
- ;; Sometimes __file__ is not defined, replace it with __name__ to fix this issue
110
- bootstrap_file = __file__
111
-
112
- ;; Exclude co objects by co_name
113
- exclude_co_names = <lambda> <listcomp> <setcomp> <dictcomp> <generator>
114
-
115
- ;; Outer key name
116
- outer_keyname = pyarmor.rkey
117
-
118
- ;; Using shared runtime package
119
- ; use_runtime = /path/to/runtime
120
-
121
- ;; How many loops for jit iv
122
- jit_iv_threshold = 100
123
-
124
138
  [runtime]
125
139
 
126
140
  ;; Generate extension for all Python3.7+
@@ -195,6 +209,7 @@ enables = builtin import function class method global local argument
195
209
  ; includes =
196
210
  ; excludes =
197
211
 
212
+ auto_excludes = super
198
213
  mix_import_name = 0
199
214
 
200
215
  [assert.call]
pyarmor/cli/generate.py CHANGED
@@ -139,6 +139,9 @@ class Builder(object):
139
139
  output = options.get('output', 'dist')
140
140
  self.ctx.outputs = output.split(',')
141
141
 
142
+ rft_auto_excludes = self.ctx.cfg['rft'].get('auto_excludes').split()
143
+ self.ctx.rft_auto_excludes.update(rft_auto_excludes)
144
+
142
145
  finder = Finder(self.ctx)
143
146
  finder.process(pack=pack)
144
147
 
pyarmor/cli/register.py CHANGED
@@ -246,6 +246,8 @@ class WebRegister(Register):
246
246
 
247
247
  lines = []
248
248
  if upgrade:
249
+ if not (rcode and rcode.startswith('pyarmor-vax-')):
250
+ raise RuntimeError('old code "%s" can not be upgraded' % rcode)
249
251
  if info['upgrade']:
250
252
  lines.append(upgrade_to_pro_info.substitute(rcode=rcode))
251
253
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyarmor.cli
3
- Version: 8.1.dev2
3
+ Version: 8.1.dev4
4
4
  Summary: A comand line tool to obfuscate python scripts
5
5
  Home-page: https://github.com/dashingsoft/pyarmor
6
6
  Author: Jondy Zhao
@@ -1,18 +1,18 @@
1
1
  pyarmor/cli/__init__.py,sha256=6igxhRpSlFLtDHnn5QGkbtE8YAtX5juBbSZQ4vc6X90,22
2
- pyarmor/cli/__main__.py,sha256=0SZd-xucjH_KnnI366TR4nzdCjr7Zh8DfRKntOiekZg,20064
2
+ pyarmor/cli/__main__.py,sha256=ro7uSNe491Z0jv27vDvLe5qZYQOtBqyJPMQx6UlpDAY,20053
3
3
  pyarmor/cli/config.py,sha256=HbCIOkJ2Zd7aGeanB1tUpBhWTj1LhyMiSwWGdmFgN0A,8608
4
- pyarmor/cli/context.py,sha256=-lz2Nxkyqx1eG3esjBhxirmGaEWjR_BFSdBIgSGOBjI,15336
5
- pyarmor/cli/default.cfg,sha256=h7wuSy93GlHaq66osQZ2cZyKI_tpOE-CwFA-w3D1yPc,7112
4
+ pyarmor/cli/context.py,sha256=tuwMJZTrHxc1CRW7cxIGXZf47y5DQUd82XInjQxCvpU,15496
5
+ pyarmor/cli/default.cfg,sha256=yGxPoGFKgSxj-oAevYLx0d0PdpVLLOBCpQuwlR6tTZc,7416
6
6
  pyarmor/cli/errors.py,sha256=gNlPhcqgCS4OVdU9H8V23YxThyvHKtFI3LKAu-sxH60,880
7
- pyarmor/cli/generate.py,sha256=7GnIcVG2G8MlaH60-7a2UcCsyedu5Cr0OH_IoOix_GQ,5603
7
+ pyarmor/cli/generate.py,sha256=eeEEWVZrhzhFp_SesNSamBs5JvqS2gaRJjN239R8diw,5742
8
8
  pyarmor/cli/mixer.py,sha256=CQOttISF-h55lWEbRUaywsNZybxe8KsXC7axO1ISxUE,4008
9
9
  pyarmor/cli/public_capsule.zip,sha256=1r4u42ixfocGPMQc0OklpoHF3nvVW6GA1f4SwcEJWVI,2487
10
- pyarmor/cli/register.py,sha256=Wbr6Q1zTPPzXOO0PoIbo65dtCMZyi5lj1n2nJBWnulw,10826
10
+ pyarmor/cli/register.py,sha256=Wc6Av9GgI20iZVVgpwwAgsxPaaZqO3CEcmcuGtYeGlw,10971
11
11
  pyarmor/cli/repack.py,sha256=JTmb-KAzPLNu_VttJTym53uJg5GJlPkmNZQ-LjM8gS8,11386
12
12
  pyarmor/cli/resource.py,sha256=VX-0rqR3xqTVdKoou9ZTl0Bk2LP7hW8qlciDVDeiGwo,6179
13
13
  pyarmor/cli/shell.py,sha256=S1yJ5RQZhTIysQgXk3H4E_cJsV2Lymh-w-_GdnHFngU,2193
14
- pyarmor.cli-8.1.dev2.dist-info/METADATA,sha256=8bctLLfGzNp4P0fsZVfLqjlJV1Z2xtBvudITZwBi0VQ,2405
15
- pyarmor.cli-8.1.dev2.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
16
- pyarmor.cli-8.1.dev2.dist-info/entry_points.txt,sha256=MODwyeC-iHX4KItYshzQRa5kWWQnMhIuT64w5bqKFR0,41
17
- pyarmor.cli-8.1.dev2.dist-info/top_level.txt,sha256=UE1ovZ_90YzwF_lZ3LV7o8HKLe-RgzUaUUvdH5UTUus,8
18
- pyarmor.cli-8.1.dev2.dist-info/RECORD,,
14
+ pyarmor.cli-8.1.dev4.dist-info/METADATA,sha256=QAbtUNJ8Oy_6Dlhu1qBMEZPWURmZMArrKoBWOJkKKQ4,2405
15
+ pyarmor.cli-8.1.dev4.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
16
+ pyarmor.cli-8.1.dev4.dist-info/entry_points.txt,sha256=MODwyeC-iHX4KItYshzQRa5kWWQnMhIuT64w5bqKFR0,41
17
+ pyarmor.cli-8.1.dev4.dist-info/top_level.txt,sha256=UE1ovZ_90YzwF_lZ3LV7o8HKLe-RgzUaUUvdH5UTUus,8
18
+ pyarmor.cli-8.1.dev4.dist-info/RECORD,,