Skip to content

Commit 4d4d40b

Browse files
committed
setuptools v81 drops dry_run= argument
1 parent 8b136a7 commit 4d4d40b

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/setuptools_dso/compiler.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: BSD
33
# See LICENSE
44
import os
5+
import logging as log
56
from functools import partial
67

78
try:
@@ -20,7 +21,17 @@
2021
from distutils.errors import DistutilsExecError as ExecError
2122
from distutils.errors import CompileError
2223
from distutils.sysconfig import customize_compiler
23-
import logging as log
24+
25+
# setuptools v81 removed --dry-run
26+
def _has_dry_run():
27+
try:
28+
from inspect import signature
29+
except ImportError: # < py3.3
30+
return True # not supported by v81
31+
else:
32+
return 'dry_run' in signature(_new_compiler).parameters
33+
34+
_has_dry_run = _has_dry_run()
2435

2536
__all__ = (
2637
'new_compiler',
@@ -78,6 +89,9 @@ def _msvc_preprocess(self, source, output_file=None, macros=None,
7889
def new_compiler(**kws):
7990
"""Returns a instance of a sub-class of distutils.ccompiler.CCompiler
8091
"""
92+
if not _has_dry_run:
93+
kws.pop('dry_run', None) # setuptools v81 no longer supports :(
94+
8195
compiler = _new_compiler(**kws)
8296
customize_compiler(compiler)
8397

src/setuptools_dso/dsocmd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ def build_dso(self, dso):
505505
if baselib!=solib:
506506
# we make best effort here, even though zipfiles (.whl or .egg) will contain copies
507507
log.info("symlink %s <- %s", solibbase, outbaselib)
508-
if not self.dry_run:
508+
if not getattr(self, 'dry_run', False):
509509
if os.path.exists(outbaselib):
510510
os.unlink(outbaselib)
511511
os.symlink(solibbase, outbaselib)
@@ -548,7 +548,7 @@ def gen_info_module(self, dso):
548548
)
549549
)
550550

551-
if not self.dry_run:
551+
if not getattr(self, 'dry_run', False):
552552
import textwrap
553553

554554
with open(info_module_filename, "w") as file:

0 commit comments

Comments
 (0)