Skip to content

Commit

Permalink
Merge pull request #260 from brenns10/main
Browse files Browse the repository at this point in the history
Use a separate build directory for free-threading
  • Loading branch information
jaraco committed Jun 28, 2024
2 parents 6bf6b9e + 01e5f2d commit 72b4407
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions distutils/command/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import sys
import sysconfig

from ..core import Command
from ..errors import DistutilsOptionError
Expand Down Expand Up @@ -81,6 +82,10 @@ def finalize_options(self): # noqa: C901

plat_specifier = f".{self.plat_name}-{sys.implementation.cache_tag}"

# Python 3.13+ with --disable-gil shouldn't share build directories
if sysconfig.get_config_var('Py_GIL_DISABLED'):
plat_specifier += 't'

# Make it so Python 2.x and Python 2.x with --with-pydebug don't
# share the same build directories. Doing so confuses the build
# process for C modules
Expand Down
3 changes: 3 additions & 0 deletions distutils/tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from distutils.command.build import build
from distutils.tests import support
from sysconfig import get_config_var
from sysconfig import get_platform


Expand All @@ -24,6 +25,8 @@ def test_finalize_options(self):
# examples:
# build/lib.macosx-10.3-i386-cpython39
plat_spec = f'.{cmd.plat_name}-{sys.implementation.cache_tag}'
if get_config_var('Py_GIL_DISABLED'):
plat_spec += 't'
if hasattr(sys, 'gettotalrefcount'):
assert cmd.build_platlib.endswith('-pydebug')
plat_spec += '-pydebug'
Expand Down

0 comments on commit 72b4407

Please sign in to comment.