saltbundlepy-packaging/saltbundlepy-packaging.spec

112 lines
3.6 KiB
RPMSpec
Raw Permalink Normal View History

#
# spec file for package saltbundlepy-packaging
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
%define pythons saltbundlepy
# Disable python bytecompile for all distros
# It's called explicitly in the spec
%global __brp_python_bytecompile %{nil}
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
# Do not build test flavor
ExclusiveArch: do-not-build
%else
%define psuffix %{nil}
%bcond_with test
%endif
Name: saltbundlepy-packaging%{psuffix}
Version: 23.1
Release: 0
Summary: Core utilities for Python packages
License: Apache-2.0 AND BSD-2-Clause
URL: https://github.com/pypa/packaging
Source: https://files.pythonhosted.org/packages/source/p/packaging/packaging-%{version}.tar.gz
BuildRequires: %{saltbundlepy_module base >= 3.10}
# python-flit-core is bootstrapped in Ring0 as well
BuildRequires: %{saltbundlepy_module flit-core >= 3.3}
BuildRequires: fdupes
BuildRequires: saltbundlepy-rpm-macros
#!BuildIgnore: post-build-checks-malwarescan
BuildArch: noarch
# do not add setuptools dependency, this is now a dependency
# of setuptools. Ensure that all dependencies also don't depend
# on setuptools
# (at the moment, six and pyparsing are ok)
%if %{with test}
BuildRequires: %{saltbundlepy_module packaging = %{version}}
BuildRequires: %{saltbundlepy_module pretend}
BuildRequires: %{saltbundlepy_module pytest}
%endif
%python_subpackages
%description
Reusable core utilities for various Python Packaging interoperability specifications.
This library provides utilities that implement the interoperability specifications
which have clearly one correct behaviour (eg: PEP 440) or benefit greatly from having
a single shared implementation (eg: PEP 425).
%prep
%autosetup -p1 -n packaging-%{version}
%if !%{with test}
%build
%{python_expand # build using pythonXX-base bundled pip with the installed flit-core backend
$python -m venv venv-%{$python_bin_suffix} --system-site-packages
venv-%{$python_bin_suffix}/bin/pip wheel %{pyproject_wheel_args} .
}
%endif
%if !%{with test}
%install
%{python_expand # install wheel (into venv sitelib) and move to buildroot system sitelib
venv-%{$python_bin_suffix}/bin/pip install %{pyproject_install_args} packaging==%{version}
venvsite=%{buildroot}${PWD}/venv-%{$python_bin_suffix}/lib/python%{$python_bin_suffix}/site-packages
mkdir -p %{buildroot}%{$python_sitelib}
mv ${venvsite}/packaging* %{buildroot}%{$python_sitelib}/
pushd %{buildroot}
%if 0%{?suse_version} == 1110
rmdir -p $(find . -name site-packages | grep venv | head -n 1 | sed 's!\./!!')
%else
rmdir -p $(realpath --relative-to ${PWD} ${venvsite})
%endif
popd
%fdupes %{buildroot}%{$python_sitelib}
}
%endif
%if %{with test}
%check
%pytest
%endif
%if !%{with test}
%files %{python_files}
%license LICENSE LICENSE.APACHE LICENSE.BSD
%doc README.rst
%{python_sitelib}/packaging
%{python_sitelib}/packaging-%{version}.dist-info
%endif
%changelog