diff --git a/CHANGELOG.md b/CHANGELOG.md index 406fd2c4..6f820d72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased +### Fixed +- Fix regression in `install_extension` crashing since 1.8.0. [#380](https://github.com/PyO3/setuptools-rust/pull/380) + ## 1.8.0 (2023-10-26) ### Packaging - Drop support for Python 3.7. [#357](https://github.com/PyO3/setuptools-rust/pull/357) diff --git a/setuptools_rust/build.py b/setuptools_rust/build.py index b5d20859..e693ccba 100644 --- a/setuptools_rust/build.py +++ b/setuptools_rust/build.py @@ -372,6 +372,8 @@ def install_extension( # will install the rust library into the module directory ext_path = self.get_dylib_ext_path(ext, module_name) + os.makedirs(os.path.dirname(ext_path), exist_ok=True) + # Make filenames relative to cwd where possible, to make logs and # errors below a little neater @@ -381,7 +383,6 @@ def install_extension( if ext_path.startswith(cwd): ext_path = os.path.relpath(ext_path, cwd) - os.makedirs(os.path.dirname(ext_path), exist_ok=True) logger.info("Copying rust artifact from %s to %s", dylib_path, ext_path) # We want to atomically replace any existing library file. We can't