Skip to content

Commit 1ef763d

Browse files
authored
Merge pull request #66 from noO0oOo0ob/feature/support-python312-313
support python3.12&3.13, not support python3.7
2 parents 90dc966 + 7d77a59 commit 1ef763d

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
unittest:
77
strategy:
88
matrix:
9-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
9+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1010
runs-on: ubuntu-latest
1111

1212
steps:

lyrebird_bugit/template_loader.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import imp
1+
import importlib
22
import traceback
33
from hashlib import md5
44
from pathlib import Path
@@ -45,7 +45,9 @@ def template_list():
4545
continue
4646
try:
4747
logger.debug(f'Load template {template_file}')
48-
template = imp.load_source(template_file.stem, str(template_file))
48+
spec = importlib.util.spec_from_file_location(template_file.stem, str(template_file))
49+
template = importlib.util.module_from_spec(spec)
50+
spec.loader.exec_module(template)
4951
template_check(template)
5052
relative_template_file_path = str(template_file).replace(str(Path.home()), '~')
5153
template_key = md5(relative_template_file_path.encode()).hexdigest()
@@ -97,7 +99,9 @@ def get_template(file_path):
9799
global last_template
98100

99101
if not last_template or last_template.__file__ != str(file_path):
100-
last_template = imp.load_source(Path(file_path).stem, str(file_path))
102+
spec = importlib.util.spec_from_file_location(Path(file_path).stem, str(file_path))
103+
last_template = importlib.util.module_from_spec(spec)
104+
spec.loader.exec_module(last_template)
101105

102106
return last_template
103107

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='lyrebird-bugit',
11-
version='1.16.1',
11+
version='1.16.2',
1212
packages=['lyrebird_bugit'],
1313
url='https://github.com/Meituan-Dianping/lyrebird-bugit',
1414
author='HBQA',
@@ -18,11 +18,12 @@
1818
zip_safe=False,
1919
classifiers=(
2020
"Programming Language :: Python :: 3 :: Only",
21-
"Programming Language :: Python :: 3.7",
2221
"Programming Language :: Python :: 3.8",
2322
"Programming Language :: Python :: 3.9",
2423
"Programming Language :: Python :: 3.10",
2524
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
"Programming Language :: Python :: 3.13",
2627
"License :: OSI Approved :: MIT License",
2728
"Operating System :: MacOS",
2829
),

0 commit comments

Comments
 (0)