Skip to content

Commit

Permalink
Fix Win Import For distutils (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 authored Oct 2, 2024
1 parent 5a67c68 commit 28383c3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
import sys
import sysconfig
from wheel.bdist_wheel import bdist_wheel
if sys.platform == 'win32':
# distutils is deprecated in Python 3.10 and removed in 3.12. However, it still works because Python defines a compatibility interface as long as setuptools is installed.
# We don't have an official alternative for distutils.ccompiler as of September 2024. See: https://github.com/pypa/setuptools/issues/2806
# Once that issue is resolved, we can migrate to the official solution.
# For now, restrict distutils to Windows only, where it's needed.
import distutils.ccompiler


def is_64bit():
Expand Down Expand Up @@ -76,7 +82,6 @@ def determine_generator_args():
if sys.platform == 'win32':
try:
# See which compiler python picks
import distutils.ccompiler
compiler = distutils.ccompiler.new_compiler()
compiler.initialize()

Expand Down Expand Up @@ -329,11 +334,6 @@ def awscrt_ext():
libraries.reverse()

if sys.platform == 'win32':
# distutils is deprecated in Python 3.10 and removed in 3.12. However, it still works because Python defines a compatibility interface as long as setuptools is installed.
# We don't have an official alternative for distutils.ccompiler as of September 2024. See: https://github.com/pypa/setuptools/issues/2806
# Once that issue is resolved, we can migrate to the official solution.
# For now, restrict distutils to Windows only, where it's needed.
import distutils.ccompiler
# the windows apis being used under the hood. Since we're static linking we have to follow the entire chain down
libraries += ['Secur32', 'Crypt32', 'Advapi32', 'NCrypt', 'BCrypt', 'Kernel32', 'Ws2_32', 'Shlwapi']
# Ensure that debug info is in the obj files, and that it is linked into the .pyd so that
Expand Down

0 comments on commit 28383c3

Please sign in to comment.