pyarmor.cli.core 5.4.2__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.
@@ -0,0 +1,156 @@
1
+ #! /usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ #############################################################
5
+ # #
6
+ # Copyright @ 2023 - Dashingsoft corp. #
7
+ # All rights reserved. #
8
+ # #
9
+ # Pyarmor #
10
+ # #
11
+ # Version: 8.0.1 - #
12
+ # #
13
+ #############################################################
14
+ #
15
+ #
16
+ # @File: pyarmor/core/__init__.py
17
+ #
18
+ # @Author: Jondy Zhao (pyarmor@163.com)
19
+ #
20
+ # @Create Date: Thu Jan 12 17:29:25 CST 2023
21
+ #
22
+
23
+ __VERSION__ = '5.4.2'
24
+
25
+
26
+ def format_platform():
27
+ import platform
28
+ import sys
29
+ from struct import calcsize
30
+
31
+ def format_system():
32
+ plat = platform.system().lower()
33
+ plat = ('windows' if plat.startswith('cygwin') else
34
+ 'linux' if plat.startswith('linux') else
35
+ 'freebsd' if plat.startswith(
36
+ ('freebsd', 'openbsd', 'isilon onefs')) else plat)
37
+ if plat == 'linux':
38
+ if hasattr(sys, 'getandroidapilevel'):
39
+ plat = 'android'
40
+ else:
41
+ cname, cver = platform.libc_ver()
42
+ if cname == 'musl':
43
+ plat = 'alpine'
44
+ elif cname == 'libc':
45
+ plat = 'android'
46
+ return plat
47
+
48
+ def format_machine():
49
+ mach = platform.machine().lower()
50
+ arch_table = (
51
+ ('x86', ('i386', 'i486', 'i586', 'i686')),
52
+ ('x86_64', ('x64', 'x86_64', 'amd64', 'intel')),
53
+ ('arm', ('armv5',)),
54
+ ('armv6', ('armv6l',)),
55
+ ('armv7', ('armv7l',)),
56
+ ('aarch32', ('aarch32',)),
57
+ ('aarch64', ('aarch64', 'arm64'))
58
+ )
59
+ for alias, archlist in arch_table:
60
+ if mach in archlist:
61
+ mach = alias
62
+ break
63
+ return mach
64
+
65
+ plat, mach = format_system(), format_machine()
66
+ if plat == 'windows' and mach == 'x86_64':
67
+ bitness = calcsize('P'.encode()) * 8
68
+ if bitness == 32:
69
+ mach = 'x86'
70
+ return plat, mach
71
+
72
+
73
+ def _import_pytransform3():
74
+ try:
75
+ return __import__(
76
+ 'pytransform3', globals=globals(), locals=locals(),
77
+ fromlist=('__pyarmor__',), level=1
78
+ )
79
+ except ModuleNotFoundError:
80
+ plat, arch = format_platform()
81
+ modname = '.'.join([plat, arch, 'pytransform3'])
82
+ return __import__(
83
+ modname, globals=globals(), locals=locals(),
84
+ fromlist=('__pyarmor__',), level=1
85
+ )
86
+
87
+
88
+ class Pytransform3(object):
89
+
90
+ _pytransform3 = None
91
+
92
+ @staticmethod
93
+ def init(ctx=None):
94
+ if Pytransform3._pytransform3 is None:
95
+ Pytransform3._pytransform3 = m = _import_pytransform3()
96
+ if ctx:
97
+ m.init_ctx(ctx)
98
+ return Pytransform3._pytransform3
99
+
100
+ @staticmethod
101
+ def generate_obfuscated_script(ctx, res):
102
+ m = Pytransform3.init(ctx)
103
+ return m.generate_obfuscated_script(ctx, res)
104
+
105
+ @staticmethod
106
+ def generate_runtime_package(ctx, output, platforms=None):
107
+ m = Pytransform3.init(ctx)
108
+ return m.generate_runtime_package(ctx, output, platforms)
109
+
110
+ @staticmethod
111
+ def generate_runtime_key(ctx, outer=None):
112
+ m = Pytransform3.init(ctx)
113
+ return m.generate_runtime_key(ctx, outer)
114
+
115
+ @staticmethod
116
+ def pre_build(ctx):
117
+ m = Pytransform3.init(ctx)
118
+ return m.pre_build(ctx)
119
+
120
+ @staticmethod
121
+ def post_build(ctx):
122
+ m = Pytransform3.init(ctx)
123
+ return m.post_build(ctx)
124
+
125
+ @staticmethod
126
+ def _update_token(ctx):
127
+ m = Pytransform3.init(ctx)
128
+ m.init_ctx(ctx)
129
+
130
+ @staticmethod
131
+ def get_hd_info(hdtype, name=None):
132
+ m = Pytransform3.init()
133
+ return m.get_hd_info(hdtype, name) if name \
134
+ else m.get_hd_info(hdtype)
135
+
136
+ @staticmethod
137
+ def version():
138
+ m = Pytransform3.init()
139
+ return m.revision
140
+
141
+
142
+ #
143
+ # Compatiable for pyarmor.cli < 8.3
144
+ #
145
+
146
+ class PyarmorRuntime(object):
147
+
148
+ @staticmethod
149
+ def get(plat, extra=None):
150
+ from os import scandir, path as os_path
151
+ if not extra:
152
+ prefix = 'pyarmor_runtime'
153
+ for entry in scandir(os_path.dirname(__file__)):
154
+ parts = entry.name.split('.')
155
+ if parts[0] == prefix and parts[-1] in ('so', 'pyd', 'dylib'):
156
+ return entry.name, os_path.abspath(entry.path)
@@ -0,0 +1,47 @@
1
+ #! /usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ #############################################################
5
+ # #
6
+ # Copyright @ 2023 - Dashingsoft corp. #
7
+ # All rights reserved. #
8
+ # #
9
+ # Pyarmor #
10
+ # #
11
+ # Version: 8.2.4 - #
12
+ # #
13
+ #############################################################
14
+ #
15
+ #
16
+ # @File: pyarmor/core/features.py
17
+ #
18
+ # @Author: Jondy Zhao (pyarmor@163.com)
19
+ #
20
+ # @Create Date: Tue Jun 6 07:57:55 CST 2023
21
+ #
22
+
23
+ # Each log
24
+ # revision, age, (new features), (changed features), (removed features)
25
+ __CHANGE_LOGS__ = (
26
+ (1, 0, (), (), ()),
27
+ )
28
+
29
+
30
+ class PyarmorFeature(object):
31
+
32
+ def features(self):
33
+ '''return features list from change logs'''
34
+ result = set()
35
+ [result.update(item[2]) for item in __CHANGE_LOGS__]
36
+ return result
37
+
38
+ def life(self, feature):
39
+ '''return first pyarmor_runtime version and last verstion to support
40
+ this feature.'''
41
+ minor, fin = None
42
+ for item in __CHANGE_LOGS__:
43
+ if feature in item[2] + item[3]:
44
+ minor = item[0]
45
+ if feature in item[-1]:
46
+ fin = item[0]
47
+ return minor, fin
@@ -0,0 +1,77 @@
1
+ #! /usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ #############################################################
5
+ # #
6
+ # Copyright @ 2023 - Dashingsoft corp. #
7
+ # All rights reserved. #
8
+ # #
9
+ # Pyarmor #
10
+ # #
11
+ # Version: 8.2.4 - #
12
+ # #
13
+ #############################################################
14
+ #
15
+ #
16
+ # @File: pyarmor/core/runtime.py
17
+ #
18
+ # @Author: Jondy Zhao (pyarmor@163.com)
19
+ #
20
+ # @Create Date: Tue Jun 6 07:50:00 CST 2023
21
+ #
22
+
23
+ PLATFORM_NAMES = (
24
+ 'windows.x86_64', 'windows.x86',
25
+ 'darwin.x86_64', 'darwin.arm64',
26
+ 'linux.x86_64', 'linux.x86', 'linux.aarch64', 'linux.armv7',
27
+ 'alpine.x86_64', 'alpine.aarch64',
28
+ 'freebsd.x86_64',
29
+ 'android.x86_64', 'android.x86', 'android.aarch64', 'android.armv7',
30
+ )
31
+
32
+
33
+ def map_platform(platname):
34
+ if platname == 'darwin.aarch64':
35
+ return 'darwin.arm64'
36
+ return platname
37
+
38
+
39
+ class PyarmorRuntime(object):
40
+
41
+ @staticmethod
42
+ def get(plat, extra=None, native=True):
43
+ from os import scandir, path as os_path
44
+ prefix = 'pyarmor_runtime'
45
+
46
+ # Themida is only available for windows
47
+ if extra == 'themida' and not plat.startswith('windows'):
48
+ extra = None
49
+
50
+ pkgpath = os_path.dirname(__file__)
51
+ if native and not extra:
52
+ path = pkgpath
53
+ for entry in scandir(path):
54
+ parts = entry.name.split('.')
55
+ if parts[0] == prefix and parts[-1] in ('so', 'pyd', 'dylib'):
56
+ return entry.name, os_path.abspath(entry.path)
57
+
58
+ dirnames = map_platform(plat).split('.')
59
+ path = os_path.join(pkgpath, extra if extra else '', *dirnames)
60
+ if not os_path.exists(path):
61
+ from pyarmor.cli.bootstrap import check_prebuilt_runtime_library
62
+ check_prebuilt_runtime_library(dirnames[:1], extra)
63
+
64
+ if os_path.exists(path):
65
+ for entry in scandir(path):
66
+ parts = entry.name.split('.')
67
+ if parts[0] == prefix and parts[-1] in ('so', 'pyd', 'dylib'):
68
+ return entry.name, os_path.abspath(entry.path)
69
+
70
+ # Fallback to pyarmor.cli.runtime
71
+ try:
72
+ from pyarmor.cli.runtime import PyarmorRuntime, __VERSION__ as ver
73
+ from logging import getLogger
74
+ getLogger('cli').info('fallback to pyarmor.cli.runtime==%s', ver)
75
+ return PyarmorRuntime.get(plat, extra=extra)
76
+ except ModuleNotFoundError:
77
+ pass
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyarmor.cli.core
3
+ Version: 5.4.2
4
+ Summary: Provide extension module pytransform3 for Pyarmor
5
+ Home-page: https://github.com/dashingsoft/pyarmor
6
+ Author: Jondy Zhao
7
+ Author-email: pyarmor@163.com
8
+ License: UNKNOWN
9
+ Keywords: protect obfuscate encrypt obfuscation distribute
10
+ Platform: UNKNOWN
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: Free To Use But Restricted
13
+ Classifier: Operating System :: Android
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: POSIX
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Topic :: Software Development :: Build Tools
19
+ Classifier: Topic :: Utilities
20
+ Classifier: Topic :: Security
21
+ Classifier: Topic :: System :: Software Distribution
22
+
23
+ pyarmo.cli.core
24
+ ===============
25
+
26
+ Pyarmor_ is a command line tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.
27
+
28
+ This package provides prebuilt `extension module`_ ``pytransform3`` and ``pyarmor_runtime`` required by Pyarmor_
29
+
30
+ It includes prebuilt extensions support the following platforms for Python 3.7+:
31
+
32
+ .. table::
33
+ :widths: auto
34
+
35
+ ======== ======== ======== ======== ======== ======== ======== ==========
36
+ Arch x86_64 i686 aarch64 aarch32 armv7 armv6 Remark
37
+ ======== ======== ======== ======== ======== ======== ======== ==========
38
+ Darwin Y No Y No No No [#]_
39
+ Linux Y Y Y (?) (?) (?) [#]_
40
+ Windows Y Y (?) No No No [#]_
41
+ Android Y Y Y No Y No [#]_
42
+ Alpine Y (?) Y (?) (?) (?)
43
+ FreeBSD Y No No No No No
44
+ ======== ======== ======== ======== ======== ======== ======== ==========
45
+
46
+ * Y: already available
47
+ * No: no support plan
48
+ * (?): not available now, maybe work in future
49
+
50
+ .. [#] Apple Silicon only for Python 3.9+
51
+ .. [#] This is built with glibc
52
+ .. [#] Themedia protection extensions are introduced in v3.2.3
53
+ .. [#] All below platforms are introduced in v3.2.3
54
+
55
+ .. _Pyarmor: https://pypi.python.org/pypi/pyarmor/
56
+ .. _Extension Module: https://packaging.python.org/en/latest/glossary/#term-Extension-Module
57
+
58
+
@@ -0,0 +1,7 @@
1
+ pyarmor/cli/core/__init__.py,sha256=YwQs6T3Mt6w-T8CqwecqCwsIjJyruCaoWva6QpBnZLc,4680
2
+ pyarmor/cli/core/features.py,sha256=8hIY19uTyiISWsTf508Za7TVH94MoitW8Z3JBWodhOY,1513
3
+ pyarmor/cli/core/runtime.py,sha256=p69Kc_Z_Y5x50FoB9I0erNmtnhiS1JXx1OflO5l7xsM,2798
4
+ pyarmor.cli.core-5.4.2.dist-info/METADATA,sha256=NQeVSp5Fig6uPONAvBDqKkfBYsMIy-9OOPp4dTqVMRE,2345
5
+ pyarmor.cli.core-5.4.2.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
6
+ pyarmor.cli.core-5.4.2.dist-info/top_level.txt,sha256=UE1ovZ_90YzwF_lZ3LV7o8HKLe-RgzUaUUvdH5UTUus,8
7
+ pyarmor.cli.core-5.4.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.34.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ pyarmor