Skip to content

Commit

Permalink
support python3.12&3.13, not support python3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
wujiasheng03 committed Jan 7, 2025
1 parent 90dc966 commit ae3669c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions lyrebird_bugit/template_loader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import imp
import importlib
import traceback
from hashlib import md5
from pathlib import Path
Expand Down Expand Up @@ -45,7 +45,9 @@ def template_list():
continue
try:
logger.debug(f'Load template {template_file}')
template = imp.load_source(template_file.stem, str(template_file))
spec = importlib.util.spec_from_file_location(template_file.stem, str(template_file))
template = importlib.util.module_from_spec(spec)
spec.loader.exec_module(template)
template_check(template)
relative_template_file_path = str(template_file).replace(str(Path.home()), '~')
template_key = md5(relative_template_file_path.encode()).hexdigest()
Expand Down Expand Up @@ -97,7 +99,9 @@ def get_template(file_path):
global last_template

if not last_template or last_template.__file__ != str(file_path):
last_template = imp.load_source(Path(file_path).stem, str(file_path))
spec = importlib.util.spec_from_file_location(Path(file_path).stem, str(file_path))
last_template = importlib.util.module_from_spec(spec)
spec.loader.exec_module(last_template)

return last_template

Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='lyrebird-bugit',
version='1.16.1',
version='1.16.2',
packages=['lyrebird_bugit'],
url='https://github.com/Meituan-Dianping/lyrebird-bugit',
author='HBQA',
Expand All @@ -18,11 +18,12 @@
zip_safe=False,
classifiers=(
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
),
Expand Down

0 comments on commit ae3669c

Please sign in to comment.