diff --git a/pyencrypt/encrypt.py b/pyencrypt/encrypt.py index 6a4a904..954b3d1 100644 --- a/pyencrypt/encrypt.py +++ b/pyencrypt/encrypt.py @@ -1,8 +1,9 @@ import os import re -import subprocess from pathlib import Path +import python_minifier + from pyencrypt.aes import aes_encrypt from pyencrypt.generate import generate_rsa_number from pyencrypt.ntt import ntt @@ -73,28 +74,17 @@ def generate_so_file(cipher_key: str, d: int, n: int, base_dir: Path = None, lic loader_file_path.touch(exist_ok=True) decrypt_source = '\n'.join(decrypt_source_ls) - loader_file_path.write_text(f"{decrypt_source}\n{loader_source}") # Origin file loader_origin_file_path = temp_dir / 'loader_origin.py' loader_origin_file_path.touch(exist_ok=True) loader_origin_file_path.write_text(f"{decrypt_source}\n{loader_source}") - args = [ - 'pyminifier', - '--obfuscate-classes', - '--obfuscate-import-methods', - '--replacement-length', - '20', - '-o', - loader_file_path.as_posix(), - loader_file_path.as_posix(), - ] - ret = subprocess.run(args, shell=False, encoding='utf-8') - if ret.returncode == 0: - pass - - from setuptools import setup + loader_file_path.write_text( + python_minifier.minify(loader_origin_file_path.read_text()) + ) + + from setuptools import setup # isort:skip from Cython.Build import cythonize from Cython.Distutils import build_ext setup( diff --git a/requirement.txt b/requirement.txt index ced629c..112162c 100644 --- a/requirement.txt +++ b/requirement.txt @@ -1,4 +1,4 @@ click==8.0.3 Cython==0.29.24 pycryptodome==3.14.1 -pyminifier==2.1 +python-minifier==2.9.0 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 16877d3..7db65bc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ keywords = python-encrypt, import-hook install_requires = Cython >= 0.29.24 pycryptodome >= 3.14.1 - pyminifier >= 2.1 + python-minifier >= 2.6.0 click python_requires = >=3.6 packages = find: