Blame tests/python-dns-lexicon.spec

b38c0ff
Name:           python-dns-lexicon
cefe82e
Version:        3.8.1
b38c0ff
Release:        0%{?dist}
b38c0ff
Summary:        Manipulate DNS records on various DNS providers in a standardized/agnostic way
b38c0ff
License:        MIT
b38c0ff
URL:            https://github.com/AnalogJ/lexicon
b38c0ff
Source0:        %{url}/archive/v%{version}/lexicon-%{version}.tar.gz
b38c0ff
BuildArch:      noarch
b38c0ff
b38c0ff
BuildRequires:  pyproject-rpm-macros
b38c0ff
BuildRequires:  python3-devel
b38c0ff
2c69069
# Upstream does not declare this dependency
2c69069
# They dropped it later: https://github.com/AnalogJ/lexicon/issues/1240
2c69069
BuildRequires:  python3-pkg_resources
2c69069
b38c0ff
%description
b38c0ff
This package has extras specified in tox configuration,
b38c0ff
we test that the extras are installed when -e is used.
b38c0ff
This package also uses a custom toxenv and creates several extras subpackages.
b38c0ff
b38c0ff
b38c0ff
%package -n     python3-dns-lexicon
b38c0ff
Summary:        %{summary}
b38c0ff
b38c0ff
%description -n python3-dns-lexicon
b38c0ff
...
b38c0ff
b38c0ff
b38c0ff
%pyproject_extras_subpackage -n python3-dns-lexicon plesk route53
b38c0ff
b38c0ff
b38c0ff
%prep
b38c0ff
%autosetup -n lexicon-%{version}
b38c0ff
# The tox configuration lists a [dev] extra, but that installs nothing (is missing).
b38c0ff
# The test requirements are only specified via poetry.dev-dependencies.
b38c0ff
# Here we amend the data a bit so we can test more things, adding the tests deps to the dev extra:
b38c0ff
sed -i \
b38c0ff
's/\[tool.poetry.extras\]/'\
b38c0ff
'pytest = {version = ">3", optional = true}\n'\
b38c0ff
'vcrpy = {version = ">1", optional = true}\n\n'\
b38c0ff
'[tool.poetry.extras]\n'\
b38c0ff
'dev = ["pytest", "vcrpy"]/' pyproject.toml
b38c0ff
b38c0ff
b38c0ff
%generate_buildrequires
b38c0ff
# We use the "light" toxenv because the default one installs the [full] extra and we don't have all the deps.
b38c0ff
# Note that [full] contains [plesk] and [route53] but we specify them manually instead:
b38c0ff
%pyproject_buildrequires -e light -x plesk -x route53
b38c0ff
b38c0ff
b38c0ff
%build
b38c0ff
%pyproject_wheel
b38c0ff
b38c0ff
b38c0ff
%install
b38c0ff
%pyproject_install
f392619
# the license is not marked as License-File by poetry-core, hence -L
f392619
%pyproject_save_files -L lexicon
b38c0ff
b38c0ff
b38c0ff
%check
b38c0ff
# we cannot use %%tox here, because the configured commands call poetry directly :/
6ae1be0
# we use %%pytest instead, running a subset of tests not to waste CI time
b38c0ff
%pytest -k "test_route53 or test_plesk"
b38c0ff
b38c0ff
b38c0ff
%files -n python3-dns-lexicon -f %{pyproject_files}
b38c0ff
%license LICENSE
b38c0ff
%doc README.rst
b38c0ff
%{_bindir}/lexicon