import osimport platformimport sysfrom distutils.errors import CCompilerErrorfrom distutils.errors import DistutilsExecErrorfrom distutils.errors import DistutilsPlatformErrorfrom setuptools import Extensionfrom setuptools import setupfrom setuptools.command.build_ext import build_extext_modules = [Extension("markupsafe._speedups", ["src/markupsafe/_speedups.c"])]class BuildFailed(Exception):passclass ve_build_ext(build_ext):"""This class allows C extension building to fail."""def run(self):try:build_ext.run(self)except DistutilsPlatformError as e:raise BuildFailed() from edef build_extension(self, ext):try:build_ext.build_extension(self, ext)except (CCompilerError, DistutilsExecError, DistutilsPlatformError) as e:raise BuildFailed() from eexcept ValueError as e:# this can happen on Windows 64 bit, see Python issue 7511if "'path'" in str(sys.exc_info()[1]): # works with Python 2 and 3raise BuildFailed() from eraisedef run_setup(with_binary):setup(name="MarkupSafe",cmdclass={"build_ext": ve_build_ext},ext_modules=ext_modules if with_binary else [],)def show_message(*lines):print("=" * 74)for line in lines:print(line)print("=" * 74)supports_speedups = platform.python_implementation() not in {"PyPy","Jython","GraalVM",}if os.environ.get("CIBUILDWHEEL", "0") == "1" and supports_speedups:run_setup(True)elif supports_speedups:try:run_setup(True)except BuildFailed:show_message("WARNING: The C extension could not be compiled, speedups"" are not enabled.","Failure information, if any, is above.","Retrying the build without the C extension now.",)run_setup(False)show_message("WARNING: The C extension could not be compiled, speedups"" are not enabled.","Plain-Python build succeeded.",)else:run_setup(False)show_message("WARNING: C extensions are not supported on this Python"" platform, speedups are not enabled.","Plain-Python build succeeded.",)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。