Skip to content

Commit

Permalink
feat: 🎸 support 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoQi99 committed Aug 27, 2024
1 parent d65095d commit 5127206
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-12, windows-2022]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip
pip install setuptools==57.5.0
pip install setuptools -U
pip install -r dev-requirement.txt
pip install .
Expand Down
20 changes: 14 additions & 6 deletions pyencrypt/encrypt.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import os
import sys
import re
import sys
from pathlib import Path
from typing import Optional

import python_minifier
try:
import python_minifier
except ImportError as exc:
if sys.version_info.minor < 12:
raise ImportError("Couldn't import python_minifier.") from exc

python_minifier = None

from pyencrypt.aes import aes_encrypt
from pyencrypt.generate import generate_rsa_number
Expand Down Expand Up @@ -93,10 +99,12 @@ def generate_so_file(
f"{decrypt_source}\n{loader_source}", encoding="utf-8"
)

loader_file_path.write_text(
python_minifier.minify(loader_origin_file_path.read_text(encoding="utf-8")),
encoding="utf-8",
)
minified_code = loader_origin_file_path.read_text(encoding="utf-8")

if python_minifier:
minified_code = python_minifier.minify(minified_code)

loader_file_path.write_text(minified_code, encoding="utf-8")

from setuptools import setup # isort:skip
from Cython.Build import cythonize
Expand Down
2 changes: 1 addition & 1 deletion requirement.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
click==8.0.3
Cython==0.29.24
pycryptodome==3.14.1
python-minifier==2.9.0
python-minifier==2.9.0; python_version < '3.12'
8 changes: 6 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Environment :: Console
license_files = LICENSE
Expand All @@ -32,13 +34,15 @@ keywords = python-encrypt, import-hook
install_requires =
Cython >= 0.29.30
pycryptodome >= 3.14.1
python-minifier >= 2.6.0
python-minifier >= 2.6.0; python_version < '3.12'
click
python_requires = >=3.6,<3.12
python_requires = >=3.6,<3.13
packages = find:
# package_dir =
# = src

[options.extras_require]

[options.packages.find]
# where = src
exclude =
Expand Down

0 comments on commit 5127206

Please sign in to comment.