pyarmor.cli.core 3.2.3__zip → 3.2.4__zip

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.

Potentially problematic release.


This version of pyarmor.cli.core might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: pyarmor.cli.core
3
- Version: 3.2.3
3
+ Version: 3.2.4
4
4
  Summary: Provide extension module pytransform3 for Pyarmor
5
5
  Home-page: https://github.com/dashingsoft/pyarmor
6
6
  Author: Jondy Zhao
@@ -45,6 +45,7 @@ Keywords: protect obfuscate encrypt obfuscation distribute
45
45
  Platform: UNKNOWN
46
46
  Classifier: Programming Language :: Python :: 3
47
47
  Classifier: License :: Free To Use But Restricted
48
+ Classifier: Operating System :: Android
48
49
  Classifier: Operating System :: MacOS
49
50
  Classifier: Operating System :: Microsoft :: Windows
50
51
  Classifier: Operating System :: POSIX
@@ -0,0 +1,34 @@
1
+ pyarmo.cli.core
2
+ ===============
3
+
4
+ Pyarmor_ is a command line tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.
5
+
6
+ This package provides `extension module`_ ``pytransform3`` and ``pyarmor_runtime`` required by Pyarmor_
7
+
8
+ It supports the following arches for Python 3.7+:
9
+
10
+ .. table::
11
+ :widths: auto
12
+
13
+ ======== ======== ======== ======== ======== ======== ======== ==========
14
+ Arch x86_64 i686 aarch64 aarch32 armv7 armv6 Remark
15
+ ======== ======== ======== ======== ======== ======== ======== ==========
16
+ Darwin Y N Y N N N [#]_
17
+ Linux Y Y Y ? ? ? [#]_
18
+ Windows Y Y ? N N N [#]_
19
+ Android Y Y Y N Y N [f1]_
20
+ Alpine Y ? Y ? ? ? [f1]_
21
+ FreeBSD Y N N N N N [f1]_
22
+ ======== ======== ======== ======== ======== ======== ======== ==========
23
+
24
+ * Y: avaiable
25
+ * N: not available even in future
26
+ * ?: not available now, maybe work in future
27
+
28
+ .. [#] Apple Silicon only for Python 3.9+
29
+ .. [#] This Linux is built with glibc
30
+ .. [#] In v3.2.3, Themedia protection extensions are introduced
31
+ .. [f1] All of these platforms are introduced in v3.2.3
32
+
33
+ .. _Pyarmor: https://pypi.python.org/pypi/pyarmor/
34
+ .. _Extension Module: https://packaging.python.org/en/latest/glossary/#term-Extension-Module
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: pyarmor.cli.core
3
- Version: 3.2.3
3
+ Version: 3.2.4
4
4
  Summary: Provide extension module pytransform3 for Pyarmor
5
5
  Home-page: https://github.com/dashingsoft/pyarmor
6
6
  Author: Jondy Zhao
@@ -45,6 +45,7 @@ Keywords: protect obfuscate encrypt obfuscation distribute
45
45
  Platform: UNKNOWN
46
46
  Classifier: Programming Language :: Python :: 3
47
47
  Classifier: License :: Free To Use But Restricted
48
+ Classifier: Operating System :: Android
48
49
  Classifier: Operating System :: MacOS
49
50
  Classifier: Operating System :: Microsoft :: Windows
50
51
  Classifier: Operating System :: POSIX
@@ -0,0 +1,10 @@
1
+ README.rst
2
+ pyproject.toml
3
+ setup.py
4
+ pyarmor.cli.core.egg-info/PKG-INFO
5
+ pyarmor.cli.core.egg-info/SOURCES.txt
6
+ pyarmor.cli.core.egg-info/dependency_links.txt
7
+ pyarmor.cli.core.egg-info/top_level.txt
8
+ src/__init__.py
9
+ src/features.py
10
+ src/runtime.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyarmor.cli.core"
7
- version = "1.0.dev2"
7
+ version = "3.2.4"
8
8
  authors = [
9
9
  { name="Jondy Zhao", email="pyarmor@163.com" },
10
10
  ]
@@ -1,22 +1,14 @@
1
1
  import sys
2
2
  from setuptools import setup
3
3
 
4
- __VERSION__ = '3.2.3'
4
+ __VERSION__ = '3.2.4'
5
5
 
6
- package_dir = '../../src-v8/cli/core'
7
- package_data = {
8
- "pyarmor.cli.core": ["pytransform3*", "pyarmor_runtime*"]
9
- }
10
-
11
- install_requires = []
12
- if hasattr(sys, 'getandroidapilevel'):
13
- install_requires.append('pyarmor.cli.core.android==%s' % __VERSION__)
14
- elif sys.platform.startswith(('freebsd', 'openbsd', 'isilon onefs')):
15
- install_requires.append('pyarmor.cli.core.freebsd==%s' % __VERSION__)
16
-
17
- with open(package_dir + '/' + 'README.rst') as f:
6
+ with open('README.rst') as f:
18
7
  long_description = f.read()
19
8
 
9
+ is_android = hasattr(sys, 'getandroidapilevel')
10
+ is_freebsd = sys.platform.startswith(('freebsd', 'openbsd', 'isilon onefs'))
11
+
20
12
  setup(
21
13
  name="pyarmor.cli.core",
22
14
 
@@ -39,6 +31,7 @@ setup(
39
31
  "License :: Free To Use But Restricted",
40
32
 
41
33
  # Support platforms
34
+ "Operating System :: Android",
42
35
  "Operating System :: MacOS",
43
36
  "Operating System :: Microsoft :: Windows",
44
37
  "Operating System :: POSIX",
@@ -58,7 +51,11 @@ setup(
58
51
  keywords="protect obfuscate encrypt obfuscation distribute",
59
52
 
60
53
  packages=["pyarmor.cli.core"],
61
- package_dir={"pyarmor.cli.core": package_dir},
62
- package_data=package_data,
63
- install_requires=install_requires,
54
+ package_dir={"pyarmor.cli.core": "src"},
55
+ package_data={"pyarmor.cli.core": ["pytransform3*", "pyarmor_runtime*"]},
56
+ install_requires=(
57
+ ['pyarmor.cli.core.android==%s' % __VERSION__] if is_android else
58
+ ['pyarmor.cli.core.freebsd==%s' % __VERSION__] if is_freebsd else
59
+ []
60
+ )
64
61
  )
@@ -0,0 +1,158 @@
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__ = '3.2.4'
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
+ prefix = 'pyarmor_runtime'
152
+ pkgpath = os_path.dirname(__file__)
153
+
154
+ path = os_path.join(pkgpath, extra if extra else '')
155
+ for entry in scandir(path):
156
+ parts = entry.name.split('.')
157
+ if parts[0] == prefix and parts[-1] in ('so', 'pyd', 'dylib'):
158
+ 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,65 @@
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
+ pkgpath = os_path.dirname(__file__)
47
+ if native and not extra:
48
+ path = pkgpath
49
+ for entry in scandir(path):
50
+ parts = entry.name.split('.')
51
+ if parts[0] == prefix and parts[-1] in ('so', 'pyd', 'dylib'):
52
+ return entry.name, os_path.abspath(entry.path)
53
+
54
+ dirnames = map_platform(plat).split('.')
55
+ if not os_path.exists(pkgpath, extra if extra else dirnames[0]):
56
+ from pyarmor.cli.bootstrap import check_runtime_package
57
+ from pyarmor.cli.core import __VERSION__ as ver
58
+ check_runtime_package(dirnames[0], ver, extra if extra else None)
59
+
60
+ path = os_path.join(pkgpath, extra if extra else '', *dirnames)
61
+ if os_path.exists(path):
62
+ for entry in scandir(path):
63
+ parts = entry.name.split('.')
64
+ if parts[0] == prefix and parts[-1] in ('so', 'pyd', 'dylib'):
65
+ return entry.name, os_path.abspath(entry.path)
@@ -1,9 +0,0 @@
1
- pyproject.toml
2
- setup.py
3
- ../../src-v8/cli/core/__init__.py
4
- ../../src-v8/cli/core/pyarmor_runtime.so
5
- ../../src-v8/cli/core/pytransform3.so
6
- pyarmor.cli.core.egg-info/PKG-INFO
7
- pyarmor.cli.core.egg-info/SOURCES.txt
8
- pyarmor.cli.core.egg-info/dependency_links.txt
9
- pyarmor.cli.core.egg-info/top_level.txt