Skip to content

Commit 13fa941

Browse files
authored
Merge pull request #283 from davidhewitt/fix-multiple-artifacts
build: fix location of multiple exec artifacts
2 parents ab51558 + f245595 commit 13fa941

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44
### Fixed
55
- Fix regression in `get_lib_name` crashing since 1.5.0. [#280](https://github.com/PyO3/setuptools-rust/pull/280)
6+
- Fix regression in `Binding.Exec` builds with multiple executables not finding built executables since 1.5.0. [#283](https://github.com/PyO3/setuptools-rust/pull/283)
67

78
## 1.5.0 (2022-08-09)
89
### Added

setuptools_rust/build.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,10 @@ def build_extension(
274274
dylib_paths.append(_BuiltModule(dest, artifact_path))
275275
else:
276276
# Find artifact from cargo messages
277-
artifacts = tuple(
278-
_find_cargo_artifacts(
279-
cargo_messages.splitlines(),
280-
package_id=package_id,
281-
kind="cdylib",
282-
)
277+
artifacts = _find_cargo_artifacts(
278+
cargo_messages.splitlines(),
279+
package_id=package_id,
280+
kind="cdylib",
283281
)
284282
if len(artifacts) == 0:
285283
raise DistutilsExecError(
@@ -660,11 +658,11 @@ def _find_cargo_artifacts(
660658
*,
661659
package_id: str,
662660
kind: str,
663-
) -> Iterable[str]:
661+
) -> List[str]:
664662
"""Identifies cargo artifacts built for the given `package_id` from the
665663
provided cargo_messages.
666664
667-
>>> list(_find_cargo_artifacts(
665+
>>> _find_cargo_artifacts(
668666
... [
669667
... '{"some_irrelevant_message": []}',
670668
... '{"reason":"compiler-artifact","package_id":"some_id","target":{"kind":["cdylib"]},"filenames":["/some/path/baz.so"]}',
@@ -673,9 +671,9 @@ def _find_cargo_artifacts(
673671
... ],
674672
... package_id="some_id",
675673
... kind="cdylib",
676-
... ))
674+
... )
677675
['/some/path/baz.so', '/file/two/baz.dylib']
678-
>>> list(_find_cargo_artifacts(
676+
>>> _find_cargo_artifacts(
679677
... [
680678
... '{"some_irrelevant_message": []}',
681679
... '{"reason":"compiler-artifact","package_id":"some_id","target":{"kind":["cdylib"]},"filenames":["/some/path/baz.so"]}',
@@ -684,9 +682,10 @@ def _find_cargo_artifacts(
684682
... ],
685683
... package_id="some_id",
686684
... kind="rlib",
687-
... ))
685+
... )
688686
['/file/two/baz.rlib']
689687
"""
688+
artifacts = []
690689
for message in cargo_messages:
691690
# only bother parsing messages that look like a match
692691
if "compiler-artifact" in message and package_id in message and kind in message:
@@ -700,7 +699,8 @@ def _find_cargo_artifacts(
700699
parsed["target"]["kind"], parsed["filenames"]
701700
):
702701
if artifact_kind == kind:
703-
yield filename
702+
artifacts.append(filename)
703+
return artifacts
704704

705705

706706
def _replace_cross_target_dir(path: str, ext: RustExtension, *, quiet: bool) -> str:

0 commit comments

Comments
 (0)