@@ -41,16 +41,13 @@ def _get_build(var, default=False):
4141
4242class BuildExtensionBugFix (BuildExtension ):
4343 def get_ext_filename (self , ext_name ):
44- # Origin: torch/utils/cpp_extension.py
45- # Fixes a bug: don't try to remove ABI part that does not
46- # exist in a file name.
44+ # A workaround to https://github.com/pytorch/pytorch/issues/170542
4745 from setuptools .command .build_ext import build_ext
4846
4947 # Get the original shared library name. For Python 3, this name will be
5048 # suffixed with "<SOABI>.so", where <SOABI> will be something like
5149 # cpython-37m-x86_64-linux-gnu.
5250 ext_filename = build_ext .get_ext_filename (self , ext_name )
53- print (f"ZZZZZZZZZZZZZZZZZZZZ 1: { ext_name } { ext_filename = } " )
5451 # If `no_python_abi_suffix` is `True`, we omit the Python 3 ABI
5552 # component. This makes building shared libraries with setuptools that
5653 # aren't Python modules nicer.
@@ -62,12 +59,19 @@ def get_ext_filename(self, ext_name):
6259 # Omit the second to last element.
6360 without_abi = ext_filename_parts [:- 2 ] + ext_filename_parts [- 1 :]
6461 ext_filename = "." .join (without_abi )
65- print (f"ZZZZZZZZZZZZZZZZZZZZ 2: { ext_filename = } " )
6662 return ext_filename
6763
64+ def get_export_symbols (self , ext ):
65+ print (f"ZZZZZZZZZZZZZZZ { ext .name = } { ext .export_symbols = } " )
66+ return ext .export_symbols
67+
6868
6969def get_build_ext ():
70- return BuildExtensionBugFix .with_options (no_python_abi_suffix = False , use_ninja = True )
70+ return BuildExtensionBugFix .with_options (
71+ # See https://github.com/pytorch/pytorch/issues/170542
72+ no_python_abi_suffix = False ,
73+ use_ninja = True ,
74+ )
7175
7276
7377def get_ext_modules ():
0 commit comments