Skip to content

Commit 214135e

Browse files
committed
Merge https://github.com/pypa/distutils into distutils-91f75bb98
2 parents d31c5b9 + 91f75bb commit 214135e

19 files changed

+2993
-2899
lines changed

setuptools/_distutils/_msvccompiler.py

Lines changed: 2 additions & 603 deletions
Large diffs are not rendered by default.

setuptools/_distutils/ccompiler.py

Lines changed: 16 additions & 1258 deletions
Large diffs are not rendered by default.

setuptools/_distutils/command/build_ext.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def get_export_symbols(self, ext):
729729
provided, "PyInit_" + module_name. Only relevant on Windows, where
730730
the .pyd file (DLL) must export the module "PyInit_" function.
731731
"""
732-
name = ext.name.split('.')[-1]
732+
name = self._get_module_name_for_symbol(ext)
733733
try:
734734
# Unicode module name support as defined in PEP-489
735735
# https://peps.python.org/pep-0489/#export-hook-name
@@ -744,6 +744,15 @@ def get_export_symbols(self, ext):
744744
ext.export_symbols.append(initfunc_name)
745745
return ext.export_symbols
746746

747+
def _get_module_name_for_symbol(self, ext):
748+
# Package name should be used for `__init__` modules
749+
# https://github.com/python/cpython/issues/80074
750+
# https://github.com/pypa/setuptools/issues/4826
751+
parts = ext.name.split(".")
752+
if parts[-1] == "__init__" and len(parts) >= 2:
753+
return parts[-2]
754+
return parts[-1]
755+
747756
def get_libraries(self, ext): # noqa: C901
748757
"""Return the list of libraries to link against when building a
749758
shared extension. On most platforms, this is just 'ext.libraries';

0 commit comments

Comments
 (0)