From e834debc6aff25281c280859ddd3caafcab85369 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 18 Feb 2017 19:53:08 +0100 Subject: [PATCH] add support for proc-macro kind Closes: https://pagure.io/fedora-rust/rust2rpm/issue/19 Signed-off-by: Igor Gnatenko --- data/macros.cargo | 4 ++-- rust2rpm/__main__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/macros.cargo b/data/macros.cargo index 67372fa..f4fa071 100644 --- a/data/macros.cargo +++ b/data/macros.cargo @@ -4,8 +4,8 @@ %cargo_registry %{_usrsrc}/rust -%__cargo_is_lib() %{expand:%__cargo_inspector --target-kinds Cargo.toml | grep -q -F lib} -%__cargo_is_bin() %{expand:%__cargo_inspector --target-kinds Cargo.toml | grep -q -F bin} +%__cargo_is_lib() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F "$(printf 'lib\\\nproc-macro')" +%__cargo_is_bin() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F bin %cargo_prep (\ set -eu \ diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index 0008c31..ced1092 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -221,7 +221,7 @@ def main(): kwargs = {} bins = [tgt for tgt in metadata.targets if tgt.kind == "bin"] - libs = [tgt for tgt in metadata.targets if tgt.kind == "lib"] + libs = [tgt for tgt in metadata.targets if tgt.kind in ("lib", "proc-macro")] is_bin = len(bins) > 0 is_lib = len(libs) > 0 if is_bin: