From 15bebc7a4ca6925c26e8685ddbf0c2d8ca788b93 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Fri, 12 Aug 2022 14:55:01 +0100 Subject: Prevent optional extensions from failing in build_ext --- setuptools/command/build_ext.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 7ad5a87a..cbfe3ec1 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -104,7 +104,8 @@ class build_ext(_build_ext): # Always copy, even if source is older than destination, to ensure # that the right extensions for the current Python/platform are # used. - self.copy_file(regular_file, inplace_file, level=self.verbose) + if os.path.exists(regular_file) or not ext.optional: + self.copy_file(regular_file, inplace_file, level=self.verbose) if ext._needs_stub: inplace_stub = self._get_equivalent_stub(ext, inplace_file) -- cgit v1.2.1