File saltbundlepy-setuptools.spec of Package saltbundlepy-setuptools

#
# spec file for package saltbundlepy-setuptools
#
# Copyright (c) 2021 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

Name:           saltbundlepy-setuptools
Version:        44.1.1
Release:        0
Summary:        Enhancements to distutils for building and distributing Python packages
License:        MIT
Group:          Development/Languages/Python
URL:            https://github.com/pypa/setuptools
Source:         https://files.pythonhosted.org/packages/source/s/setuptools/setuptools-%{version}.zip
Patch0:         sort-for-reproducibility.patch
Patch1:         importlib.patch
BuildRequires:  fdupes
BuildRequires:  saltbundlepy-rpm-macros
BuildRequires:  %{saltbundlepy_module base}
BuildRequires:  unzip
# The dependency download feature may require SSL, which is in python3-base and python(2)
Requires:       saltbundlepy-base
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides:       python-distribute = %{version}
Obsoletes:      python-distribute < %{version}
BuildArch:      noarch
%python_subpackages

%description
setuptools is a collection of enhancements to the Python distutils that
allow you to build and distribute Python packages,
especially ones that have dependencies on other packages.

%prep
%setup -q -n setuptools-%{version}
%patch0 -p1
%patch1 -p1

# strip shebangs to fix rpmlint warnings
# "explain the sed":
# 1 = first line only
# s@...@...@ = same as s/.../.../ except with @ instead of /
# ^ = start; #!/ = shebang leading characters; .* = rest of line; $ = end
# replace with nothing
sed -r -i '1s@^#!/.*$@@' setuptools/command/easy_install.py

%build
%python_build

%install
%python_install

%python_clone -a %{buildroot}%{_bindir}/easy_install

%python_expand %fdupes %{buildroot}%{$python_sitelib}

%post
%python_install_alternative easy_install

%postun
%python_uninstall_alternative easy_install

%files %{python_files}
%defattr(-,root,root)
%license LICENSE
%doc CHANGES.rst README.rst
%{_bindir}/easy_install*
%{python_sitelib}/easy_install*
%{python_sitelib}/setuptools
%{python_sitelib}/setuptools-%{version}-py*.egg-info
%{python_sitelib}/__pycache__/*.pyc
%dir %{python_sitelib}/pkg_resources
%{python_sitelib}/pkg_resources/*
%ghost %_sysconfdir/alternatives/easy_install

%changelog
openSUSE Build Service is sponsored by