From 9696550bb7440cb465078a52c76537a77b5e5ce3 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Thu, 16 Feb 2023 21:39:51 +0100 Subject: [PATCH] meta: require cargo2rpm >= 0.1.2 to fix edge case in "is-lib" checks --- requirements.txt | 2 +- rust2rpm/generator.py | 6 ++---- rust2rpm/metadata.py | 8 -------- setup.cfg | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/requirements.txt b/requirements.txt index b652f4c..8209dd7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -cargo2rpm +cargo2rpm>=0.1.2 jinja2 pyparsing requests diff --git a/rust2rpm/generator.py b/rust2rpm/generator.py index 697b6cc..8369fe9 100644 --- a/rust2rpm/generator.py +++ b/rust2rpm/generator.py @@ -1,7 +1,5 @@ """ Functionality for rendering the spec file template. - -FIXME: document which parameters the template actually uses """ import time @@ -13,7 +11,7 @@ import jinja2 from rust2rpm import __version__, log from rust2rpm.licensing import translate_license -from rust2rpm.metadata import guess_main_package, package_uses_rust_1_60_feature_syntax, metadata_is_cdylib +from rust2rpm.metadata import guess_main_package, package_uses_rust_1_60_feature_syntax def to_list(s): @@ -126,7 +124,7 @@ def spec_render_crate( is_bin = metadata.is_bin() is_lib = metadata.is_lib() - is_cdylib = metadata_is_cdylib(metadata) + is_cdylib = metadata.is_cdylib() package = metadata.packages[0] description = package.get_description() diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py index b88c9c1..6a9f1bd 100644 --- a/rust2rpm/metadata.py +++ b/rust2rpm/metadata.py @@ -1,14 +1,6 @@ from cargo2rpm.metadata import Metadata, Package -def metadata_is_cdylib(metadata: Metadata) -> bool: - for package in metadata.packages: - for target in package.targets: - if "cdylib" in target.kind and "cdylib" in target.crate_types: - return True - return False - - def guess_main_package(metadata: Metadata) -> Package: if not metadata.is_workspace(): return metadata.packages[0] diff --git a/setup.cfg b/setup.cfg index 1042a72..6183ede 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,7 @@ classifiers = include_package_data = True packages = rust2rpm install_requires = - cargo2rpm + cargo2rpm>=0.1.2 jinja2 pyparsing requests