[pyarmor]

;; Pyarmor version
major = 8
minor = 1
patch = 7

;; Core version
cli.core = 2.1
cli.runtime = 2.1

;; Default timeout when send request to remote server for
;;     check Pyarmor license
;;     register Pyarmor license
timeout = 6

regurl = https://api.dashingsoft.com/product/key/enter/%s/?
buyurl = https://order.mycommerce.com/product?vendorid=200089125&productid=301044051

[logging]

debug_logfile = .pyarmor/pyarmor.debug.log
trace_logfile = .pyarmor/pyarmor.trace.log

[finder]
recursive = 0
;; includes =
;; excludes =
pyexts = .py .pyw

;; Data files need to copy to output path
;;   *.txt only copy .txt file
;;   * means all data files
;;   0 means nothing to copy
data_files = 0

;;
;; How to find dependent packages
;;
findall = 0

[builder]
;;
;; Part 1: only global/local settings, not in module level
;;

;; File encoding to read scripts
encoding = utf-8

;; Trace obfuscation
enable_trace = 0

;; Use Themida to protect runtime package in windows
enable_themida = 0

;; Import prefix to import runtime package
import_prefix = 0

;; Sometimes __file__ is not defined, replace it with __name__ to fix this issue
bootstrap_file = __file__

;; Exclude co objects by co_name
exclude_co_names = <lambda> <listcomp> <setcomp> <dictcomp> <generator>

;; Common modules which are no restrict
exclude_restrict_modules = __init__

;; Outer key name
outer_keyname = pyarmor.rkey

;; inline_plugin = "# pyarmor: "
inline_plugin = 1

;; Using shared runtime package
; use_runtime = /path/to/runtime

;; How many loops for jit iv
jit_iv_threshold = 100

;; Now "argument" is not available
rft_enables = builtin import function class method global local

;; Exclude unknown attrs automically
;    0     disable auto exclude, use auto include
;    1     auto exclude and load .pyarmor/rft/exclude_table
;    2     auto exclude but not load exclude_table
rft_auto_exclude = 1

;; Export all the names in module attribute __all__
rft_auto_export = 1

;; Enable dev mode for rft
rft_dev_mode = 0

;; Export module and classes
; rft_export_names = pkg.mod pkg.mod.cls pkg.mod.attr

;; Extra paths to find dependent package
; pypaths =

;; List module names couldn't be found automically
; hidden_imports =

;;
;; Part 2: global/local/module level options
;;

;; The argument optimize specifies the optimization level of the
;; compiler; the default value of -1 selects the optimization level of
;; the interpreter as given by -O options. Explicit levels are 0 (no
;; optimization; __debug__ is true), 1 (asserts are removed, __debug__
;; is false) or 2 (docstrings are removed too).
optimize = 1

;; It's not used now
type_comments = false

;; Write refactor result scripts
trace_rft = 0

enable_jit = 0
enable_bcc = 0
enable_rft = 0

;; assert: call import
assert_call = 0
assert_import = 0

;; mix string constant
mix_str = 0

mix_coname = 0
mix_localnames = 1
;; Enable it may result in annotations error
mix_argnames = 0

obf_module = 1
obf_code = 1
wrap_mode = 1

restrict_module = 1

;;
;; Advanced features
;;

;; check license when importing each module
import_check_license = 0

;; clear module co after importing
clear_module_co = 1

;; clear frame.f_locals for wrap mode, it's meanless for non-wrap mode
clear_frame_locals = 0

;; Model level to rename attributes ruler
;;
;;    x.y.z:?.%.z
;;
;;    ?  auto map
;;    %  force rename
;;
; rft_rulers =

;; Model level to exclude names
; rft_excludes =

;; Whether encrypt name in statement import
rft_mix_import_name = 0

[runtime]

;; Generate extension for all Python3.7+
universal = 0

;; The file ext only keep .so/.pyd, for example
;;     pyarmor_runtime.cpython-37m-darwin.so
;;     if simple_extension_name == 1 then
;;     pyarmor_runtime.so
simple_extension_name = 1

;; Enable outer runtime key
outer = 0

;; Pyarmor raises PyExc_RuntimeError by default
;;     0    raise PyExc_RuntimeError
;;     1    raise PyExc_SystemExit
;;     2    call libc exit to quit directly
on_error = 0

;; Check runtime key periodically, support formats:
;;   3600s
;;   60m
;;   1h
;;   1
; period = 1

;; Expired runtime key. Check local time if there is leading '.',
;; otherwise check ntp time
;;
;;     30
;;     2025-12-31
;;
;;     .30
;;     .2025-12-30
;;
; expired =

;; Check ntp time by this server
nts = pool.ntp.org
nts_timeout = 3

;; Bind runtime key to multiple devices, one line one machine
; devices =

;; Bind runtime key to Python interperter. Each line defines a rule,
;; match all the rules. The rule formats
;;
;;      s: symbol symbol DIFF
;;      S: symbol symbol xxxxxx(md5)
;;      f: name SIZE
;;      F: name xxxxxxxx(md5)
;;      m: name SIZE
;;      M: name xxxxxxxx(md5)
; interps =

;; Insert runtime hooks
; hooks = hooks.py

;; Enable timer
timer = 0

;; Target platforms
; platforms =

;; If there are customized runtime messages
messages = messages.cfg:utf-8

[assert.call]
;; and: function is in obfuscated script and match ruler
;;  or: function is in obfuscated script or match ruler
auto_mode = and

; includes =
; excludes =

[assert.import]
;; and: module is obfuscated and match ruler
;;  or: module is obfuscated or match ruler
auto_mode = and

; includes =
; excludes =

[mix.str]
;; do not mix short string len(s) < this value
threshold = 4

; includes =
; excludes =

[pack]
;; Strip output path to match archive info
strip = 0

;; How to handle other .pyc in the bundle
;;     0  not obfuscate
;;     1  obf module only
;;     2  obf module and co_code without lambda and comprehensions
;;     3  obf module and all co_code
other_pyc = 0

;; How to do when the obfuscated module has no matched .pyc in bundle
;;    error, issue a error and exit
;;    warning, issue a warning and continue
;;    ignore, do nothing
;;    append, append it to archive
no_matched_pyc = error

[bcc]
unsupported_functions = exec eval super locals __assert_armored__
unsupported_nodes = AsyncFunctionDef AsyncFor AsyncWith Await Yield YieldFrom GeneratorExp NamedExpr MatchValue MatchSingleton MatchSequence MatchMapping MatchClass MatchStar MatchAs MatchOr

;; Exclude co_names
; excludes =

;; Use opcode CALL_FUNCTION_EX to patch call
;; Global option, all scripts must be same
call_function_ex = 0

;; Generate bcc function to show right lineno in traceback
;; If disable, lineno is always function definition lineno
trace_lineno = 0

keep_nest_name = 0

;; Do not convert lambda to bcc
ignore_lambda = 0

;; Use op_mkfunc2 to build unsupported functions
enable_pure_function = 1

;; Convert comprehensions to bcc code
enable_comprehension = 1

[windows.x86_64.bcc]
cc = clang.exe
cflags = -O3 -Wno-unsequenced -fno-asynchronous-unwind-tables -fno-unwind-tables --target=x86_64-elf-windows -c

[linux.x86_64.bcc]
cflags = -O3 -Wno-unsequenced -fno-asynchronous-unwind-tables -fno-unwind-tables -fPIC -fno-stack-protector -c

[linux.aarch64.bcc]
cflags = -O3 -Wno-unsequenced -fno-asynchronous-unwind-tables -fno-unwind-tables -fPIC -fno-stack-protector -shared -nostdlib -Tlinux.aarch64.ldscript

[darwin.x86_64.bcc]
cflags = -O3 -Wno-unsequenced -fno-asynchronous-unwind-tables -fno-unwind-tables --target=x86_64-elf-gnu_linux -fPIC -c

[darwin.aarch64.bcc]
cflags = -O3 -Wno-unsequenced -fno-asynchronous-unwind-tables -fno-unwind-tables --target=arm64-macho-darwin -fPIC -fno-addrsig -fno-stack-protector -shared -nostdlib -lsystem
