Use importlib_resources on python<3.9

This commit is contained in:
Kevin Phoenix 2024-07-02 12:15:07 -07:00
parent 0acbec877a
commit f23d862b03
2 changed files with 10 additions and 2 deletions

View File

@ -391,10 +391,15 @@ CS_OPT = {v:k for k,v in locals().items() if k.startswith('CS_OPT_')}
import ctypes, ctypes.util
from os.path import split, join, dirname
import sysconfig
from importlib import resources
from pathlib import PurePath
import inspect
if sys.version_info >= (3, 9):
import importlib.resources as resources
else:
import importlib_resources as resources
if not hasattr(sys.modules[__name__], '__file__'):
__file__ = inspect.getfile(inspect.currentframe())

View File

@ -231,5 +231,8 @@ setup(
include_package_data=True,
package_data={
"capstone": ["lib/*", "include/capstone/*"],
}
},
install_requires=[
"importlib_resources;python_version<'3.9'",
],
)