py39compat.py 639 B

12345678910111213141516171819202122
  1. import sys
  2. import platform
  3. def add_ext_suffix_39(vars):
  4. """
  5. Ensure vars contains 'EXT_SUFFIX'. pypa/distutils#130
  6. """
  7. import _imp
  8. ext_suffix = _imp.extension_suffixes()[0]
  9. vars.update(
  10. EXT_SUFFIX=ext_suffix,
  11. # sysconfig sets SO to match EXT_SUFFIX, so maintain
  12. # that expectation.
  13. # https://github.com/python/cpython/blob/785cc6770588de087d09e89a69110af2542be208/Lib/sysconfig.py#L671-L673
  14. SO=ext_suffix,
  15. )
  16. needs_ext_suffix = sys.version_info < (3, 10) and platform.system() == 'Windows'
  17. add_ext_suffix = add_ext_suffix_39 if needs_ext_suffix else lambda vars: None